vfs_cluster.c (6875) | vfs_cluster.c (7090) |
---|---|
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.11 1995/03/02 19:36:50 davidg Exp $ | 36 * $Id: vfs_cluster.c,v 1.12 1995/03/04 03:24:28 davidg Exp $ |
37 */ 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/proc.h> 42#include <sys/buf.h> 43#include <sys/vnode.h> 44#include <sys/mount.h> --- 15 unchanged lines hidden (view full) --- 60#define doreallocblks 0 61#endif 62 63/* 64 * Local declarations 65 */ 66struct buf *cluster_rbuild __P((struct vnode *, u_quad_t, struct buf *, 67 daddr_t, daddr_t, long, int, long)); | 37 */ 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/proc.h> 42#include <sys/buf.h> 43#include <sys/vnode.h> 44#include <sys/mount.h> --- 15 unchanged lines hidden (view full) --- 60#define doreallocblks 0 61#endif 62 63/* 64 * Local declarations 65 */ 66struct buf *cluster_rbuild __P((struct vnode *, u_quad_t, struct buf *, 67 daddr_t, daddr_t, long, int, long)); |
68void cluster_wbuild __P((struct vnode *, struct buf *, long, daddr_t, int, daddr_t)); | |
69struct cluster_save *cluster_collectbufs __P((struct vnode *, struct buf *)); 70 71int totreads; 72int totreadblocks; 73 74#ifdef DIAGNOSTIC 75/* 76 * Set to 1 if reads of block zero should cause readahead to be done. --- 426 unchanged lines hidden (view full) --- 503redo: 504 if( (lbn != -1) || (last_bp == 0)) { 505 while ((!(tbp = incore(vp, start_lbn)) || (tbp->b_flags & B_BUSY) 506 || (start_lbn == lbn)) && len) { 507 ++start_lbn; 508 --len; 509 } 510 | 68struct cluster_save *cluster_collectbufs __P((struct vnode *, struct buf *)); 69 70int totreads; 71int totreadblocks; 72 73#ifdef DIAGNOSTIC 74/* 75 * Set to 1 if reads of block zero should cause readahead to be done. --- 426 unchanged lines hidden (view full) --- 502redo: 503 if( (lbn != -1) || (last_bp == 0)) { 504 while ((!(tbp = incore(vp, start_lbn)) || (tbp->b_flags & B_BUSY) 505 || (start_lbn == lbn)) && len) { 506 ++start_lbn; 507 --len; 508 } 509 |
511 pb = (struct buf *) trypbuf(); | 510 pb = trypbuf(); |
512 /* Get more memory for current buffer */ 513 if (len <= 1 || pb == 0) { 514 relpbuf(pb); 515 if (last_bp) { 516 bawrite(last_bp); 517 } else if (len) { 518 bp = getblk(vp, start_lbn, size, 0, 0); 519 bawrite(bp); 520 } 521 return; 522 } 523 tbp = getblk(vp, start_lbn, size, 0, 0); 524 } else { 525 tbp = last_bp; 526 if( tbp->b_flags & B_BUSY) { 527 printf("vfs_cluster: warning: buffer already busy\n"); 528 } 529 tbp->b_flags |= B_BUSY; 530 last_bp = 0; | 511 /* Get more memory for current buffer */ 512 if (len <= 1 || pb == 0) { 513 relpbuf(pb); 514 if (last_bp) { 515 bawrite(last_bp); 516 } else if (len) { 517 bp = getblk(vp, start_lbn, size, 0, 0); 518 bawrite(bp); 519 } 520 return; 521 } 522 tbp = getblk(vp, start_lbn, size, 0, 0); 523 } else { 524 tbp = last_bp; 525 if( tbp->b_flags & B_BUSY) { 526 printf("vfs_cluster: warning: buffer already busy\n"); 527 } 528 tbp->b_flags |= B_BUSY; 529 last_bp = 0; |
531 pb = (struct buf *) trypbuf(); | 530 pb = trypbuf(); |
532 if( pb == 0) { 533 bawrite(tbp); 534 return; 535 } 536 } 537 538 if (!(tbp->b_flags & B_DELWRI)) { 539 relpbuf(pb); --- 122 unchanged lines hidden --- | 531 if( pb == 0) { 532 bawrite(tbp); 533 return; 534 } 535 } 536 537 if (!(tbp->b_flags & B_DELWRI)) { 538 relpbuf(pb); --- 122 unchanged lines hidden --- |