Garbage-collect vn_write_suspend_wait().
Suggested and reviewed by: tegge Tested by: pho MFC after: 1 month
This commit is contained in:
parent
90446e360c
commit
bdb8094763
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user