summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2005-05-22 17:37:50 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2005-05-22 17:37:50 +0000
commit20945b8f22ed6160442c3a3fc82c3606b1b28027 (patch)
treea580ff08e671caea2f0edfbca9900fb8359f045e /sys
parent6f98f313500ba56e7f7946301e1eb1a9c04ad652 (diff)
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@
Diffstat (limited to 'sys')
-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);
}