diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-11-27 05:27:13 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-11-27 05:27:13 +0000 |
commit | 8a1845e49f56720cbfccd4c7f5f80ba5b980fdf4 (patch) | |
tree | d4a522dc41cdc79ba48fe761e94663b795da8cc0 /sys/msdosfs/msdosfs_denode.c | |
parent | 0d68e9b5af14f4bfa04d22dbebab5972ac647b26 (diff) |
Merge in the unified buffer cache code as found in NetBSD 2001/03/10. The
code is written mostly by Chuck Silvers <chuq@chuq.com>/<chs@netbsd.org>.
Tested for the past few weeks by many developers, should be in a pretty stable
state, but will require optimizations and additional cleanups.
Diffstat (limited to 'sys/msdosfs/msdosfs_denode.c')
-rw-r--r-- | sys/msdosfs/msdosfs_denode.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/msdosfs/msdosfs_denode.c b/sys/msdosfs/msdosfs_denode.c index eb82f75afe3..f4ab33d5272 100644 --- a/sys/msdosfs/msdosfs_denode.c +++ b/sys/msdosfs/msdosfs_denode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_denode.c,v 1.19 2001/11/06 19:53:20 miod Exp $ */ +/* $OpenBSD: msdosfs_denode.c,v 1.20 2001/11/27 05:27:12 art Exp $ */ /* $NetBSD: msdosfs_denode.c,v 1.23 1997/10/17 11:23:58 ws Exp $ */ /*- @@ -72,6 +72,8 @@ u_long dehash; /* size of hash table - 1 */ #define DEHASH(dev, dcl, doff) (((dev) + (dcl) + (doff) / sizeof(struct direntry)) \ & dehash) +extern int prtactive; + static struct denode *msdosfs_hashget __P((dev_t, u_long, u_long)); static int msdosfs_hashins __P((struct denode *)); static void msdosfs_hashrem __P((struct denode *)); @@ -332,6 +334,7 @@ retry: nvp->v_type = VREG; VREF(ldep->de_devvp); *depp = ldep; + nvp->v_uvm.u_size = ldep->de_FileSize; return (0); } @@ -461,7 +464,7 @@ detrunc(dep, length, flags, cred, p) #endif return (error); } - uvm_vnp_uncache(DETOV(dep)); + /* * is this the right place for it? */ @@ -524,7 +527,7 @@ deextend(dep, length, cred) struct ucred *cred; { struct msdosfsmount *pmp = dep->de_pmp; - u_long count; + u_long count, osize; int error; /* @@ -557,8 +560,12 @@ deextend(dep, length, cred) } } + osize = dep->de_FileSize; dep->de_FileSize = length; + uvm_vnp_setsize(DETOV(dep), (voff_t)dep->de_FileSize); dep->de_flag |= DE_UPDATE|DE_MODIFIED; + uvm_vnp_zerorange(DETOV(dep), (off_t)osize, + (size_t)(dep->de_FileSize - osize)); return (deupdat(dep, 1)); } @@ -593,7 +600,6 @@ msdosfs_reclaim(v) } */ *ap = v; struct vnode *vp = ap->a_vp; struct denode *dep = VTODE(vp); - extern int prtactive; #ifdef MSDOSFS_DEBUG printf("msdosfs_reclaim(): dep %08x, file %s, refcnt %d\n", @@ -634,7 +640,6 @@ msdosfs_inactive(v) struct denode *dep = VTODE(vp); struct proc *p = ap->a_p; int error; - extern int prtactive; #ifdef MSDOSFS_DEBUG printf("msdosfs_inactive(): dep %08x, de_Name[0] %x\n", dep, dep->de_Name[0]); @@ -661,7 +666,9 @@ msdosfs_inactive(v) dep, dep->de_refcnt, vp->v_mount->mnt_flag, MNT_RDONLY); #endif if (dep->de_refcnt <= 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) { - error = detrunc(dep, (u_long)0, 0, NOCRED, NULL); + if (dep->de_FileSize != 0) { + error = detrunc(dep, (u_long)0, 0, NOCRED, NULL); + } dep->de_Name[0] = SLOT_DELETED; } deupdat(dep, 0); |