vfs: return free vnode batches in sync instead of vfs_msync

It is a more natural fit. vfs_msync only deals with active vnodes.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D22008
This commit is contained in:
mjg 2019-10-13 15:39:11 +00:00
parent b2fd2fd625
commit c576b0223d

View File

@ -4395,8 +4395,6 @@ vfs_msync(struct mount *mp, int flags)
CTR2(KTR_VFS, "%s: mp %p", __func__, mp);
vnlru_return_batch(mp);
MNT_VNODE_FOREACH_ACTIVE(vp, mp, mvp) {
obj = vp->v_object;
if (obj != NULL && (obj->flags & OBJ_MIGHTBEDIRTY) != 0 &&
@ -4628,6 +4626,11 @@ sync_fsync(struct vop_fsync_args *ap)
return (0);
}
save = curthread_pflags_set(TDP_SYNCIO);
/*
* The filesystem at hand may be idle with free vnodes stored in the
* batch. Return them instead of letting them stay there indefinitely.
*/
vnlru_return_batch(mp);
vfs_msync(mp, MNT_NOWAIT);
error = VFS_SYNC(mp, MNT_LAZY);
curthread_pflags_restore(save);