diff options
author | mckusick <mckusick@FreeBSD.org> | 1999-07-04 00:31:17 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 1999-07-04 00:31:17 +0000 |
commit | 7a0f4e876e718f864cb71d636ac17622cf1fbd02 (patch) | |
tree | 30e00ad878e19966c2246426b111a4f827fa2748 /sys/kern/vfs_cluster.c | |
parent | 9d4f0d78faaae0a9bd808ea72476ec00a6109c13 (diff) | |
download | FreeBSD-src-7a0f4e876e718f864cb71d636ac17622cf1fbd02.zip FreeBSD-src-7a0f4e876e718f864cb71d636ac17622cf1fbd02.tar.gz |
The vfs.write_behind sysctl and related code support has been added to
allow changes to the filesystem's write_behind behavior. By the
default the filesystem aggressively issues write_behind's. Three values
may be specified for vfs.write_behind. 0 disables write_behind, 1 results
in historical operation (agressive write_behind), and 2 is an experimental
backed-off write_behind. The values of 0 and 1 are recommended. The value
of 0 is recommended in conjuction with an increase in the number of
NBUF's and the number of dirty buffers allowed (vfs.{lo,hi}dirtybuffers).
Note that a value of 0 will radically increase the dirty buffer load on
the system. Future work on write_behind behavior will use values 2 and
greater for testing purposes.
Submitted by: Matthew Dillon <dillon@apollo.backplane.com>
Reviewed by: Kirk McKusick <mckusick@mckusick.com>
Diffstat (limited to 'sys/kern/vfs_cluster.c')
-rw-r--r-- | sys/kern/vfs_cluster.c | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c index f235e4e..9a9eb60 100644 --- a/sys/kern/vfs_cluster.c +++ b/sys/kern/vfs_cluster.c @@ -33,7 +33,7 @@ * SUCH DAMAGE. * * @(#)vfs_cluster.c 8.7 (Berkeley) 2/13/94 - * $Id: vfs_cluster.c,v 1.84 1999/06/26 02:46:08 mckusick Exp $ + * $Id: vfs_cluster.c,v 1.85 1999/06/29 05:59:43 peter Exp $ */ #include "opt_debug_cluster.h" @@ -51,6 +51,7 @@ #include <vm/vm_prot.h> #include <vm/vm_object.h> #include <vm/vm_page.h> +#include <sys/sysctl.h> #if defined(CLUSTERDEBUG) #include <sys/sysctl.h> @@ -66,6 +67,9 @@ static struct buf * cluster_rbuild __P((struct vnode *vp, u_quad_t filesize, daddr_t lbn, daddr_t blkno, long size, int run, struct buf *fbp)); +static int write_behind = 1; +SYSCTL_INT(_vfs, OID_AUTO, write_behind, CTLFLAG_RW, &write_behind, 0, ""); + extern vm_page_t bogus_page; extern int cluster_pbuf_freecnt; @@ -153,12 +157,14 @@ cluster_read(vp, filesize, lblkno, size, cred, totread, seqcount, bpp) (i == (maxra - 1))) tbp->b_flags |= B_RAM; +#if 0 if ((tbp->b_usecount < 1) && BUF_REFCNT(tbp) == 0 && (tbp->b_qindex == QUEUE_LRU)) { TAILQ_REMOVE(&bufqueues[QUEUE_LRU], tbp, b_freelist); TAILQ_INSERT_TAIL(&bufqueues[QUEUE_LRU], tbp, b_freelist); } +#endif } splx(s); if (i >= maxra) { @@ -495,6 +501,37 @@ cluster_callback(bp) } /* + * cluster_wbuild_wb: + * + * Implement modified write build for cluster. + * + * write_behind = 0 write behind disabled + * write_behind = 1 write behind normal (default) + * write_behind = 2 write behind backed-off + */ + +static __inline int +cluster_wbuild_wb(struct vnode *vp, long size, daddr_t start_lbn, int len) +{ + int r = 0; + + switch(write_behind) { + case 2: + if (start_lbn < len) + break; + start_lbn -= len; + /* fall through */ + case 1: + r = cluster_wbuild(vp, size, start_lbn, len); + /* fall through */ + default: + /* fall through */ + break; + } + return(r); +} + +/* * Do clustered write for FFS. * * Three cases: @@ -566,7 +603,7 @@ cluster_write(bp, filesize) bpp < endbp; bpp++) brelse(*bpp); free(buflist, M_SEGMENT); - cluster_wbuild(vp, lblocksize, + cluster_wbuild_wb(vp, lblocksize, vp->v_cstart, cursize); } else { /* @@ -612,7 +649,7 @@ cluster_write(bp, filesize) * At end of cluster, write it out. */ bdwrite(bp); - cluster_wbuild(vp, lblocksize, vp->v_cstart, vp->v_clen + 1); + cluster_wbuild_wb(vp, lblocksize, vp->v_cstart, vp->v_clen + 1); vp->v_clen = 0; vp->v_cstart = lbn + 1; } else |