Simplify the code and remove two mutex operations.

MFC after:	2 weeks
This commit is contained in:
Pawel Jakub Dawidek 2006-06-24 22:55:43 +00:00
parent 0705941372
commit 92c0849935

View File

@ -1089,23 +1089,19 @@ vfs_write_suspend(mp)
struct thread *td = curthread;
int error;
error = 0;
MNT_ILOCK(mp);
if (mp->mnt_kern_flag & MNTK_SUSPEND)
goto unlock;
if (mp->mnt_kern_flag & MNTK_SUSPEND) {
MNT_IUNLOCK(mp);
return (0);
}
mp->mnt_kern_flag |= MNTK_SUSPEND;
if (mp->mnt_writeopcount > 0)
(void) msleep(&mp->mnt_writeopcount,
MNT_MTX(mp), (PUSER - 1)|PDROP, "suspwt", 0);
else
MNT_IUNLOCK(mp);
if ((error = VFS_SYNC(mp, MNT_SUSPEND, td)) != 0) {
if ((error = VFS_SYNC(mp, MNT_SUSPEND, td)) != 0)
vfs_write_resume(mp);
return (error);
}
MNT_ILOCK(mp);
unlock:
MNT_IUNLOCK(mp);
return (error);
}