Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Oct 1996 11:38:49 +0100 (BST)
From:      Doug Rabson <dfr@render.com>
To:        Charles Henrich <henrich@crh.cl.msu.edu>, Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>, lite2@freebsd.org
Subject:   Delayed write patch
Message-ID:  <Pine.BSF.3.95.961009113604.10204c-100000@minnow.render.com>

next in thread | raw e-mail | index | archive | help
There was a stupid mistake in the delayed write patch I just sent out.
This patch should work as intended.  Still makes no difference for me
though.

Index: nfs_syscalls.c
===================================================================
RCS file: /host/minnow/b/dfr/lite2/src/sys/nfs/nfs_syscalls.c,v
retrieving revision 1.14.2000.1
diff -u -r1.14.2000.1 nfs_syscalls.c
--- nfs_syscalls.c	1996/09/23 13:25:16	1.14.2000.1
+++ nfs_syscalls.c	1996/10/09 10:36:28
@@ -88,6 +88,7 @@
 extern int nfsrvw_procrastinate;
 struct nfssvc_sock *nfs_udpsock, *nfs_cltpsock;
 static int nuidhash_max = NFS_MAXUIDHASH;
+int nfs_maxdelwri = 1;
 
 static void	nfsrv_zapsock __P((struct nfssvc_sock *slp));
 static int	nfssvc_iod __P((struct proc *));
@@ -762,19 +763,28 @@
 		     * avoid any risk of the vnode getting vclean()'d while
 		     * we are doing the write rpc.
 		     */
+		    int ndelwri = 0;
 		    vp = bp->b_vp;
-		    s = splbio();
-		    for (nbp = vp->v_dirtyblkhd.lh_first; nbp;
-			nbp = nbp->b_vnbufs.le_next) {
-			if ((nbp->b_flags &
-			    (B_BUSY|B_DELWRI|B_NEEDCOMMIT|B_NOCACHE))!=B_DELWRI)
-			    continue;
-			bremfree(nbp);
-			vfs_busy_pages(nbp, 1);
-			nbp->b_flags |= (B_BUSY|B_ASYNC);
-			break;
-		    }
-		    splx(s);
+		    /*
+		     * Limit the number of B_DELWRI buffers we handle to
+		     * avoid locking out the other iods.
+		     */
+		    if (ndelwri < nfs_maxdelwri) {
+			s = splbio();
+			for (nbp = vp->v_dirtyblkhd.lh_first; nbp;
+			     nbp = nbp->b_vnbufs.le_next) {
+			    if ((nbp->b_flags &
+				 (B_BUSY|B_DELWRI|B_NEEDCOMMIT|B_NOCACHE))!=B_DELWRI)
+				continue;
+			    bremfree(nbp);
+			    vfs_busy_pages(nbp, 1);
+			    nbp->b_flags |= (B_BUSY|B_ASYNC);
+			    ndelwri++;
+			    break;
+			}
+			splx(s);
+		    } else
+			nbp = NULL;
 		    /*
 		     * For the delayed write, do the first part of nfs_bwrite()
 		     * up to, but not including nfs_strategy().


--
Doug Rabson, Microsoft RenderMorphics Ltd.	Mail:  dfr@render.com
						Phone: +44 171 734 3761
						FAX:   +44 171 734 6426




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.961009113604.10204c-100000>