diff options
| author | David Greenman <dg@FreeBSD.org> | 1994-08-29 06:09:15 +0000 |
|---|---|---|
| committer | David Greenman <dg@FreeBSD.org> | 1994-08-29 06:09:15 +0000 |
| commit | 1cdeb653a8376801b645b2d06a2004f96b8c683b (patch) | |
| tree | 9d47e82a6bd75190c972a7809b3e6351a1c03b1d | |
| parent | e348d9c3a847c666d186242d46723eeaaa4db465 (diff) | |
Notes
| -rw-r--r-- | sys/kern/vfs_export.c | 22 | ||||
| -rw-r--r-- | sys/kern/vfs_subr.c | 22 | ||||
| -rw-r--r-- | sys/nfs/nfs_serv.c | 5 | ||||
| -rw-r--r-- | sys/nfs/nfs_vnops.c | 20 | ||||
| -rw-r--r-- | sys/nfsclient/nfs_vnops.c | 20 | ||||
| -rw-r--r-- | sys/nfsserver/nfs_serv.c | 5 | ||||
| -rw-r--r-- | sys/sys/vnode.h | 6 | ||||
| -rw-r--r-- | sys/ufs/ffs/ffs_inode.c | 6 | ||||
| -rw-r--r-- | sys/ufs/lfs/lfs_alloc.c | 3 | ||||
| -rw-r--r-- | sys/ufs/lfs/lfs_inode.c | 3 |
10 files changed, 64 insertions, 48 deletions
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index 138910bc2a08..3f048ecc43ab 100644 --- a/sys/kern/vfs_export.c +++ b/sys/kern/vfs_export.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94 - * $Id: vfs_subr.c,v 1.6 1994/08/22 17:05:00 davidg Exp $ + * $Id: vfs_subr.c,v 1.7 1994/08/24 04:06:39 davidg Exp $ */ /* @@ -437,6 +437,8 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo) register struct buf *bp; struct buf *nbp, *blist; int s, error; + vm_pager_t pager; + vm_object_t object; if (flags & V_SAVE) { if (error = VOP_FSYNC(vp, cred, MNT_WAIT, p)) @@ -445,7 +447,7 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo) panic("vinvalbuf: dirty bufs"); } for (;;) { - if ((blist = vp->v_cleanblkhd.lh_first) && flags & V_SAVEMETA) + if ((blist = vp->v_cleanblkhd.lh_first) && (flags & V_SAVEMETA)) while (blist && blist->b_lblkno < 0) blist = blist->b_vnbufs.le_next; if (!blist && (blist = vp->v_dirtyblkhd.lh_first) && @@ -457,7 +459,7 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo) for (bp = blist; bp; bp = nbp) { nbp = bp->b_vnbufs.le_next; - if (flags & V_SAVEMETA && bp->b_lblkno < 0) + if ((flags & V_SAVEMETA) && bp->b_lblkno < 0) continue; s = splbio(); if (bp->b_flags & B_BUSY) { @@ -486,6 +488,20 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo) brelse(bp); } } + + pager = (vm_pager_t)vp->v_vmdata; + if (pager != NULL) { + object = vm_object_lookup(pager); + if (object) { + vm_object_lock(object); + if (flags & V_SAVE) + vm_object_page_clean(object, 0, 0, TRUE, FALSE); + vm_object_page_remove(object, 0, object->size); + vm_object_unlock(object); + vm_object_deallocate(object); + } + } + if (!(flags & V_SAVEMETA) && (vp->v_dirtyblkhd.lh_first || vp->v_cleanblkhd.lh_first)) panic("vinvalbuf: flush failed"); diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 138910bc2a08..3f048ecc43ab 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94 - * $Id: vfs_subr.c,v 1.6 1994/08/22 17:05:00 davidg Exp $ + * $Id: vfs_subr.c,v 1.7 1994/08/24 04:06:39 davidg Exp $ */ /* @@ -437,6 +437,8 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo) register struct buf *bp; struct buf *nbp, *blist; int s, error; + vm_pager_t pager; + vm_object_t object; if (flags & V_SAVE) { if (error = VOP_FSYNC(vp, cred, MNT_WAIT, p)) @@ -445,7 +447,7 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo) panic("vinvalbuf: dirty bufs"); } for (;;) { - if ((blist = vp->v_cleanblkhd.lh_first) && flags & V_SAVEMETA) + if ((blist = vp->v_cleanblkhd.lh_first) && (flags & V_SAVEMETA)) while (blist && blist->b_lblkno < 0) blist = blist->b_vnbufs.le_next; if (!blist && (blist = vp->v_dirtyblkhd.lh_first) && @@ -457,7 +459,7 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo) for (bp = blist; bp; bp = nbp) { nbp = bp->b_vnbufs.le_next; - if (flags & V_SAVEMETA && bp->b_lblkno < 0) + if ((flags & V_SAVEMETA) && bp->b_lblkno < 0) continue; s = splbio(); if (bp->b_flags & B_BUSY) { @@ -486,6 +488,20 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo) brelse(bp); } } + + pager = (vm_pager_t)vp->v_vmdata; + if (pager != NULL) { + object = vm_object_lookup(pager); + if (object) { + vm_object_lock(object); + if (flags & V_SAVE) + vm_object_page_clean(object, 0, 0, TRUE, FALSE); + vm_object_page_remove(object, 0, object->size); + vm_object_unlock(object); + vm_object_deallocate(object); + } + } + if (!(flags & V_SAVEMETA) && (vp->v_dirtyblkhd.lh_first || vp->v_cleanblkhd.lh_first)) panic("vinvalbuf: flush failed"); diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c index 4ae812028f27..0184b276713e 100644 --- a/sys/nfs/nfs_serv.c +++ b/sys/nfs/nfs_serv.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94 - * $Id$ + * $Id: nfs_serv.c,v 1.3 1994/08/02 07:52:09 davidg Exp $ */ /* @@ -881,8 +881,7 @@ nfsrv_remove(nfsd, mrep, md, dpos, cred, nam, mrq) error = EBUSY; goto out; } - if (vp->v_flag & VTEXT) - (void) vnode_pager_uncache(vp); + (void) vnode_pager_uncache(vp); out: if (!error) { nqsrv_getl(nd.ni_dvp, NQL_WRITE); diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 70a6a88e527f..8a77bfbe5ca7 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vnops.c 8.5 (Berkeley) 2/13/94 - * $Id: nfs_vnops.c,v 1.3 1994/08/02 07:52:18 davidg Exp $ + * $Id: nfs_vnops.c,v 1.4 1994/08/08 17:30:53 davidg Exp $ */ /* @@ -339,11 +339,10 @@ nfs_open(ap) if (vp->v_type != VREG && vp->v_type != VDIR && vp->v_type != VLNK) return (EACCES); - if (vp->v_flag & VTEXT) { - /* - * Get a valid lease. If cached data is stale, flush it. - */ - if (nmp->nm_flag & NFSMNT_NQNFS) { + /* + * Get a valid lease. If cached data is stale, flush it. + */ + if (nmp->nm_flag & NFSMNT_NQNFS) { if (NQNFS_CKINVALID(vp, np, NQL_READ)) { do { error = nqnfs_getlease(vp, NQL_READ, ap->a_cred, ap->a_p); @@ -355,16 +354,14 @@ nfs_open(ap) if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1)) == EINTR) return (error); - (void) vnode_pager_uncache(vp); np->n_brev = np->n_lrev; } } - } else { + } else { if (np->n_flag & NMODIFIED) { if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1)) == EINTR) return (error); - (void) vnode_pager_uncache(vp); np->n_attrstamp = 0; np->n_direofoffset = 0; if (error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_p)) @@ -378,12 +375,11 @@ nfs_open(ap) if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1)) == EINTR) return (error); - (void) vnode_pager_uncache(vp); np->n_mtime = vattr.va_mtime.ts_sec; } } - } - } else if ((nmp->nm_flag & NFSMNT_NQNFS) == 0) + } + if ((nmp->nm_flag & NFSMNT_NQNFS) == 0) np->n_attrstamp = 0; /* For Open/Close consistency */ return (0); } diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index 70a6a88e527f..8a77bfbe5ca7 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vnops.c 8.5 (Berkeley) 2/13/94 - * $Id: nfs_vnops.c,v 1.3 1994/08/02 07:52:18 davidg Exp $ + * $Id: nfs_vnops.c,v 1.4 1994/08/08 17:30:53 davidg Exp $ */ /* @@ -339,11 +339,10 @@ nfs_open(ap) if (vp->v_type != VREG && vp->v_type != VDIR && vp->v_type != VLNK) return (EACCES); - if (vp->v_flag & VTEXT) { - /* - * Get a valid lease. If cached data is stale, flush it. - */ - if (nmp->nm_flag & NFSMNT_NQNFS) { + /* + * Get a valid lease. If cached data is stale, flush it. + */ + if (nmp->nm_flag & NFSMNT_NQNFS) { if (NQNFS_CKINVALID(vp, np, NQL_READ)) { do { error = nqnfs_getlease(vp, NQL_READ, ap->a_cred, ap->a_p); @@ -355,16 +354,14 @@ nfs_open(ap) if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1)) == EINTR) return (error); - (void) vnode_pager_uncache(vp); np->n_brev = np->n_lrev; } } - } else { + } else { if (np->n_flag & NMODIFIED) { if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1)) == EINTR) return (error); - (void) vnode_pager_uncache(vp); np->n_attrstamp = 0; np->n_direofoffset = 0; if (error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_p)) @@ -378,12 +375,11 @@ nfs_open(ap) if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1)) == EINTR) return (error); - (void) vnode_pager_uncache(vp); np->n_mtime = vattr.va_mtime.ts_sec; } } - } - } else if ((nmp->nm_flag & NFSMNT_NQNFS) == 0) + } + if ((nmp->nm_flag & NFSMNT_NQNFS) == 0) np->n_attrstamp = 0; /* For Open/Close consistency */ return (0); } diff --git a/sys/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c index 4ae812028f27..0184b276713e 100644 --- a/sys/nfsserver/nfs_serv.c +++ b/sys/nfsserver/nfs_serv.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94 - * $Id$ + * $Id: nfs_serv.c,v 1.3 1994/08/02 07:52:09 davidg Exp $ */ /* @@ -881,8 +881,7 @@ nfsrv_remove(nfsd, mrep, md, dpos, cred, nam, mrq) error = EBUSY; goto out; } - if (vp->v_flag & VTEXT) - (void) vnode_pager_uncache(vp); + (void) vnode_pager_uncache(vp); out: if (!error) { nqsrv_getl(nd.ni_dvp, NQL_WRITE); diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index ed5108e20a16..3c2a9a86b62f 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)vnode.h 8.7 (Berkeley) 2/4/94 - * $Id: vnode.h,v 1.2 1994/08/02 07:54:13 davidg Exp $ + * $Id: vnode.h,v 1.3 1994/08/21 04:42:15 paul Exp $ */ #ifndef _SYS_VNODE_H_ @@ -85,7 +85,6 @@ struct vnode { union { struct mount *vu_mountedhere;/* ptr to mounted vfs (VDIR) */ struct socket *vu_socket; /* unix ipc (VSOCK) */ - caddr_t vu_vmdata; /* private data for vm (VREG) */ struct specinfo *vu_specinfo; /* device (VCHR, VBLK) */ struct fifoinfo *vu_fifoinfo; /* fifo (VFIFO) */ } v_un; @@ -96,13 +95,12 @@ struct vnode { int v_clen; /* length of current cluster */ int v_ralen; /* Read-ahead length */ daddr_t v_maxra; /* last readahead block */ - long v_spare[7]; /* round to 128 bytes */ + caddr_t v_vmdata; /* Place to store VM pager */ enum vtagtype v_tag; /* type of underlying data */ void *v_data; /* private data for fs */ }; #define v_mountedhere v_un.vu_mountedhere #define v_socket v_un.vu_socket -#define v_vmdata v_un.vu_vmdata #define v_specinfo v_un.vu_specinfo #define v_fifoinfo v_un.vu_fifoinfo diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 2e1c6706b398..a7cd2a41f392 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_inode.c 8.5 (Berkeley) 12/30/93 - * $Id: ffs_inode.c,v 1.4 1994/08/02 13:51:05 davidg Exp $ + * $Id: ffs_inode.c,v 1.5 1994/08/03 08:19:35 davidg Exp $ */ #include <sys/param.h> @@ -190,7 +190,7 @@ ffs_truncate(ap) /* * Lengthen the size of the file. We must ensure that the * last byte of the file is allocated. Since the smallest - * value of oszie is 0, length will be at least 1. + * value of osize is 0, length will be at least 1. */ if (osize < length) { offset = blkoff(fs, length - 1); @@ -202,7 +202,6 @@ ffs_truncate(ap) aflags)) return (error); oip->i_size = length; - (void) vnode_pager_uncache(ovp); if (aflags & IO_SYNC) bwrite(bp); else @@ -230,7 +229,6 @@ ffs_truncate(ap) return (error); oip->i_size = length; size = blksize(fs, oip, lbn); - (void) vnode_pager_uncache(ovp); bzero((char *)bp->b_data + offset, (u_int)(size - offset)); allocbuf(bp, size); if (aflags & IO_SYNC) diff --git a/sys/ufs/lfs/lfs_alloc.c b/sys/ufs/lfs/lfs_alloc.c index 848bb81a50db..5e8f2b97877d 100644 --- a/sys/ufs/lfs/lfs_alloc.c +++ b/sys/ufs/lfs/lfs_alloc.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)lfs_alloc.c 8.4 (Berkeley) 1/4/94 - * $Id: lfs_alloc.c,v 1.2 1994/08/02 07:54:29 davidg Exp $ + * $Id: lfs_alloc.c,v 1.3 1994/08/20 03:49:00 davidg Exp $ */ #include <sys/param.h> @@ -99,7 +99,6 @@ lfs_valloc(ap) lfs_balloc(vp, fs->lfs_bsize, blkno, &bp); ip->i_size += fs->lfs_bsize; vnode_pager_setsize(vp, (u_long)ip->i_size); - vnode_pager_uncache(vp); i = (blkno - fs->lfs_segtabsz - fs->lfs_cleansz) * fs->lfs_ifpb; diff --git a/sys/ufs/lfs/lfs_inode.c b/sys/ufs/lfs/lfs_inode.c index 263c8bc7f5ba..36d0b94fa156 100644 --- a/sys/ufs/lfs/lfs_inode.c +++ b/sys/ufs/lfs/lfs_inode.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)lfs_inode.c 8.5 (Berkeley) 12/30/93 - * $Id$ + * $Id: lfs_inode.c,v 1.2 1994/08/02 07:54:35 davidg Exp $ */ #include <sys/param.h> @@ -217,7 +217,6 @@ lfs_truncate(ap) return (e1); ip->i_size = length; size = blksize(fs); - (void)vnode_pager_uncache(vp); bzero((char *)bp->b_data + offset, (u_int)(size - offset)); allocbuf(bp, size); if (e1 = VOP_BWRITE(bp)) |
