Author: mjg
Date: Sun Oct 13 15:39:11 2019
New Revision: 353468
URL: https://svnweb.freebsd.org/changeset/base/353468

Log:
  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

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c    Sun Oct 13 15:15:09 2019        (r353467)
+++ head/sys/kern/vfs_subr.c    Sun Oct 13 15:39:11 2019        (r353468)
@@ -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);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to