From bdb80947637137efd798dfcf47298bddb9d40413 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Tue, 16 Sep 2008 11:09:26 +0000 Subject: [PATCH] Garbage-collect vn_write_suspend_wait(). Suggested and reviewed by: tegge Tested by: pho MFC after: 1 month --- sys/gnu/fs/ext2fs/ext2_inode.c | 12 ++------ sys/kern/vfs_vnops.c | 50 ---------------------------------- sys/sys/vnode.h | 2 -- 3 files changed, 2 insertions(+), 62 deletions(-) diff --git a/sys/gnu/fs/ext2fs/ext2_inode.c b/sys/gnu/fs/ext2fs/ext2_inode.c index 04a9d46300ce..086f73957976 100644 --- a/sys/gnu/fs/ext2fs/ext2_inode.c +++ b/sys/gnu/fs/ext2fs/ext2_inode.c @@ -481,7 +481,6 @@ ext2_inactive(ap) if (ip->i_mode == 0) goto out; if (ip->i_nlink <= 0) { - (void) vn_write_suspend_wait(vp, NULL, V_WAIT); error = ext2_truncate(vp, (off_t)0, 0, NOCRED, td); ip->i_rdev = 0; mode = ip->i_mode; @@ -489,15 +488,8 @@ ext2_inactive(ap) ip->i_flag |= IN_CHANGE | IN_UPDATE; ext2_vfree(vp, ip->i_number, mode); } - if (ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) { - if ((ip->i_flag & (IN_CHANGE | IN_UPDATE | IN_MODIFIED)) == 0 && - vn_write_suspend_wait(vp, NULL, V_NOWAIT)) { - ip->i_flag &= ~IN_ACCESS; - } else { - (void) vn_write_suspend_wait(vp, NULL, V_WAIT); - ext2_update(vp, 0); - } - } + if (ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) + ext2_update(vp, 0); out: /* * If we are done with the inode, reclaim it diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 6e7c5a072c28..58863f4311ad 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -966,56 +966,6 @@ vn_start_write(vp, mpp, flags) return (error); } -/* - * Secondary suspension. Used by operations such as vop_inactive - * routines that are needed by the higher level functions. These - * are allowed to proceed until all the higher level functions have - * completed (indicated by mnt_writeopcount dropping to zero). At that - * time, these operations are halted until the suspension is over. - */ -int -vn_write_suspend_wait(vp, mp, flags) - struct vnode *vp; - struct mount *mp; - int flags; -{ - int error; - - if (vp != NULL) { - if ((error = VOP_GETWRITEMOUNT(vp, &mp)) != 0) { - if (error != EOPNOTSUPP) - return (error); - return (0); - } - } - /* - * If we are not suspended or have not yet reached suspended - * mode, then let the operation proceed. - */ - if (mp == NULL) - return (0); - MNT_ILOCK(mp); - if (vp == NULL) - MNT_REF(mp); - if ((mp->mnt_kern_flag & MNTK_SUSPENDED) == 0) { - MNT_REL(mp); - MNT_IUNLOCK(mp); - return (0); - } - if (flags & V_NOWAIT) { - MNT_REL(mp); - MNT_IUNLOCK(mp); - return (EWOULDBLOCK); - } - /* - * Wait for the suspension to finish. - */ - error = msleep(&mp->mnt_flag, MNT_MTX(mp), - (PUSER - 1) | (flags & PCATCH) | PDROP, "suspfs", 0); - vfs_rel(mp); - return (error); -} - /* * Secondary suspension. Used by operations such as vop_inactive * routines that are needed by the higher level functions. These diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 990b5dfde7ef..472f273fea35 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -629,8 +629,6 @@ int vn_stat(struct vnode *vp, struct stat *sb, struct ucred *active_cred, int vn_start_write(struct vnode *vp, struct mount **mpp, int flags); int vn_start_secondary_write(struct vnode *vp, struct mount **mpp, int flags); -int vn_write_suspend_wait(struct vnode *vp, struct mount *mp, - int flags); int vn_writechk(struct vnode *vp); int vn_extattr_get(struct vnode *vp, int ioflg, int attrnamespace, const char *attrname, int *buflen, char *buf, struct thread *td);