Deleted Added
full compact
vfs_cluster.c (42453) vfs_cluster.c (42957)
1/*-
2 * Copyright (c) 1993
3 * The Regents of the University of California. All rights reserved.
4 * Modifications/enhancements:
5 * Copyright (c) 1995 John S. Dyson. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 19 unchanged lines hidden (view full) ---

28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * @(#)vfs_cluster.c 8.7 (Berkeley) 2/13/94
1/*-
2 * Copyright (c) 1993
3 * The Regents of the University of California. All rights reserved.
4 * Modifications/enhancements:
5 * Copyright (c) 1995 John S. Dyson. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 19 unchanged lines hidden (view full) ---

28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * @(#)vfs_cluster.c 8.7 (Berkeley) 2/13/94
36 * $Id: vfs_cluster.c,v 1.76 1999/01/08 17:31:15 eivind Exp $
36 * $Id: vfs_cluster.c,v 1.77 1999/01/10 01:58:25 eivind Exp $
37 */
38
39#include "opt_debug_cluster.h"
40
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/kernel.h>
44#include <sys/proc.h>

--- 18 unchanged lines hidden (view full) ---

63static struct cluster_save *
64 cluster_collectbufs __P((struct vnode *vp, struct buf *last_bp));
65static struct buf *
66 cluster_rbuild __P((struct vnode *vp, u_quad_t filesize, daddr_t lbn,
67 daddr_t blkno, long size, int run, struct buf *fbp));
68
69extern vm_page_t bogus_page;
70
37 */
38
39#include "opt_debug_cluster.h"
40
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/kernel.h>
44#include <sys/proc.h>

--- 18 unchanged lines hidden (view full) ---

63static struct cluster_save *
64 cluster_collectbufs __P((struct vnode *vp, struct buf *last_bp));
65static struct buf *
66 cluster_rbuild __P((struct vnode *vp, u_quad_t filesize, daddr_t lbn,
67 daddr_t blkno, long size, int run, struct buf *fbp));
68
69extern vm_page_t bogus_page;
70
71extern int cluster_pbuf_freecnt;
72
71/*
72 * Maximum number of blocks for read-ahead.
73 */
74#define MAXRA 32
75
76/*
77 * This replaces bread.
78 */

--- 252 unchanged lines hidden (view full) ---

331 tbp->b_flags |= B_ASYNC | B_READ | B_RAM;
332 }
333
334 tbp->b_blkno = blkno;
335 if( (tbp->b_flags & B_MALLOC) ||
336 ((tbp->b_flags & B_VMIO) == 0) || (run <= 1) )
337 return tbp;
338
73/*
74 * Maximum number of blocks for read-ahead.
75 */
76#define MAXRA 32
77
78/*
79 * This replaces bread.
80 */

--- 252 unchanged lines hidden (view full) ---

333 tbp->b_flags |= B_ASYNC | B_READ | B_RAM;
334 }
335
336 tbp->b_blkno = blkno;
337 if( (tbp->b_flags & B_MALLOC) ||
338 ((tbp->b_flags & B_VMIO) == 0) || (run <= 1) )
339 return tbp;
340
339 bp = trypbuf();
341 bp = trypbuf(&cluster_pbuf_freecnt);
340 if (bp == 0)
341 return tbp;
342
343 bp->b_data = (char *)((vm_offset_t)bp->b_data |
344 ((vm_offset_t)tbp->b_data & PAGE_MASK));
345 bp->b_flags = B_ASYNC | B_READ | B_CALL | B_BUSY | B_CLUSTER | B_VMIO;
346 bp->b_iodone = cluster_callback;
347 bp->b_blkno = blkno;

--- 122 unchanged lines hidden (view full) ---

470 nbp = TAILQ_NEXT(&tbp->b_cluster, cluster_entry);
471 if (error) {
472 tbp->b_flags |= B_ERROR;
473 tbp->b_error = error;
474 } else
475 tbp->b_dirtyoff = tbp->b_dirtyend = 0;
476 biodone(tbp);
477 }
342 if (bp == 0)
343 return tbp;
344
345 bp->b_data = (char *)((vm_offset_t)bp->b_data |
346 ((vm_offset_t)tbp->b_data & PAGE_MASK));
347 bp->b_flags = B_ASYNC | B_READ | B_CALL | B_BUSY | B_CLUSTER | B_VMIO;
348 bp->b_iodone = cluster_callback;
349 bp->b_blkno = blkno;

--- 122 unchanged lines hidden (view full) ---

472 nbp = TAILQ_NEXT(&tbp->b_cluster, cluster_entry);
473 if (error) {
474 tbp->b_flags |= B_ERROR;
475 tbp->b_error = error;
476 } else
477 tbp->b_dirtyoff = tbp->b_dirtyend = 0;
478 biodone(tbp);
479 }
478 relpbuf(bp);
480 relpbuf(bp, &cluster_pbuf_freecnt);
479}
480
481/*
482 * Do clustered write for FFS.
483 *
484 * Three cases:
485 * 1. Write is not sequential (write asynchronously)
486 * Write is sequential:

--- 162 unchanged lines hidden (view full) ---

649 * memory down to after our max possible cluster size and then
650 * potentially pull it back up if the cluster was terminated
651 * prematurely--too much hassle.
652 */
653 if (((tbp->b_flags & (B_CLUSTEROK|B_MALLOC)) != B_CLUSTEROK) ||
654 (tbp->b_bcount != tbp->b_bufsize) ||
655 (tbp->b_bcount != size) ||
656 (len == 1) ||
481}
482
483/*
484 * Do clustered write for FFS.
485 *
486 * Three cases:
487 * 1. Write is not sequential (write asynchronously)
488 * Write is sequential:

--- 162 unchanged lines hidden (view full) ---

651 * memory down to after our max possible cluster size and then
652 * potentially pull it back up if the cluster was terminated
653 * prematurely--too much hassle.
654 */
655 if (((tbp->b_flags & (B_CLUSTEROK|B_MALLOC)) != B_CLUSTEROK) ||
656 (tbp->b_bcount != tbp->b_bufsize) ||
657 (tbp->b_bcount != size) ||
658 (len == 1) ||
657 ((bp = trypbuf()) == NULL)) {
659 ((bp = trypbuf(&cluster_pbuf_freecnt)) == NULL)) {
658 totalwritten += tbp->b_bufsize;
659 bawrite(tbp);
660 ++start_lbn;
661 --len;
662 continue;
663 }
664
665 /*

--- 173 unchanged lines hidden ---
660 totalwritten += tbp->b_bufsize;
661 bawrite(tbp);
662 ++start_lbn;
663 --len;
664 continue;
665 }
666
667 /*

--- 173 unchanged lines hidden ---