diff options
| author | Kirk McKusick <mckusick@FreeBSD.org> | 1999-07-04 00:31:17 +0000 |
|---|---|---|
| committer | Kirk McKusick <mckusick@FreeBSD.org> | 1999-07-04 00:31:17 +0000 |
| commit | 1c9ca5858f45f6fe39fd85981bdb296fde48262f (patch) | |
| tree | 93850d33a73e47d7fb54ea55afe6f06d2a20a8ad | |
| parent | e929c00d238991e28a14ecaa1a4b53efde0e12d4 (diff) | |
Notes
| -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 f235e4ede6a2..9a9eb60ebad0 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 |
