summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpedro <pedro@openbsd.org>2005-05-22 17:37:49 +0000
committerpedro <pedro@openbsd.org>2005-05-22 17:37:49 +0000
commitf6e4ec723dd6afcb4557627d6a71b6f80fd02db1 (patch)
tree740870ca70eb664bb79cfca9ac42654e6d43dc12
parentfix setting of the "need ack" flag. (diff)
downloadwireguard-openbsd-f6e4ec723dd6afcb4557627d6a71b6f80fd02db1.tar.xz
wireguard-openbsd-f6e4ec723dd6afcb4557627d6a71b6f80fd02db1.zip
optimize nfs_sync() a bit, by not iterating over the list of vnodes
belonging to a mount point if we want to skip all of them, okay art@ a couple of days ago, commit it deraadt@
-rw-r--r--sys/nfs/nfs_vfsops.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c
index 208cb0ef8aa..c86675ce7cf 100644
--- a/sys/nfs/nfs_vfsops.c
+++ b/sys/nfs/nfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vfsops.c,v 1.56 2005/03/31 21:39:44 deraadt Exp $ */
+/* $OpenBSD: nfs_vfsops.c,v 1.57 2005/05/22 17:37:49 pedro Exp $ */
/* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */
/*
@@ -823,6 +823,12 @@ nfs_sync(mp, waitfor, cred, p)
int error, allerror = 0;
/*
+ * Don't traverse the vnode list if we want to skip all of them.
+ */
+ if (waitfor == MNT_LAZY)
+ return (allerror);
+
+ /*
* Force stale buffer cache information to be flushed.
*/
loop:
@@ -834,8 +840,7 @@ loop:
*/
if (vp->v_mount != mp)
goto loop;
- if (VOP_ISLOCKED(vp) || LIST_FIRST(&vp->v_dirtyblkhd) == NULL ||
- waitfor == MNT_LAZY)
+ if (VOP_ISLOCKED(vp) || LIST_FIRST(&vp->v_dirtyblkhd) == NULL)
continue;
if (vget(vp, LK_EXCLUSIVE, p))
goto loop;
@@ -844,6 +849,7 @@ loop:
allerror = error;
vput(vp);
}
+
return (allerror);
}