vfs_cluster.c (254945) | vfs_cluster.c (283735) |
---|---|
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 --- 18 unchanged lines hidden (view full) --- 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 * 31 * @(#)vfs_cluster.c 8.7 (Berkeley) 2/13/94 32 */ 33 34#include <sys/cdefs.h> | 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 --- 18 unchanged lines hidden (view full) --- 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 * 31 * @(#)vfs_cluster.c 8.7 (Berkeley) 2/13/94 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/kern/vfs_cluster.c 254945 2013-08-27 01:31:12Z kib $"); | 35__FBSDID("$FreeBSD: head/sys/kern/vfs_cluster.c 283735 2015-05-29 13:24:17Z kib $"); |
36 37#include "opt_debug_cluster.h" 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/kernel.h> 42#include <sys/proc.h> 43#include <sys/bio.h> --- 261 unchanged lines hidden (view full) --- 305 * If blocks are contiguous on disk, use this to provide clustered 306 * read ahead. We will read as many blocks as possible sequentially 307 * and then parcel them up into logical blocks in the buffer hash table. 308 */ 309static struct buf * 310cluster_rbuild(struct vnode *vp, u_quad_t filesize, daddr_t lbn, 311 daddr_t blkno, long size, int run, int gbflags, struct buf *fbp) 312{ | 36 37#include "opt_debug_cluster.h" 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/kernel.h> 42#include <sys/proc.h> 43#include <sys/bio.h> --- 261 unchanged lines hidden (view full) --- 305 * If blocks are contiguous on disk, use this to provide clustered 306 * read ahead. We will read as many blocks as possible sequentially 307 * and then parcel them up into logical blocks in the buffer hash table. 308 */ 309static struct buf * 310cluster_rbuild(struct vnode *vp, u_quad_t filesize, daddr_t lbn, 311 daddr_t blkno, long size, int run, int gbflags, struct buf *fbp) 312{ |
313 struct bufobj *bo; | |
314 struct buf *bp, *tbp; 315 daddr_t bn; 316 off_t off; 317 long tinc, tsize; 318 int i, inc, j, k, toff; 319 320 KASSERT(size == vp->v_mount->mnt_stat.f_iosize, 321 ("cluster_rbuild: size %ld != f_iosize %jd\n", --- 49 unchanged lines hidden (view full) --- 371 372 TAILQ_INIT(&bp->b_cluster.cluster_head); 373 374 bp->b_bcount = 0; 375 bp->b_bufsize = 0; 376 bp->b_npages = 0; 377 378 inc = btodb(size); | 313 struct buf *bp, *tbp; 314 daddr_t bn; 315 off_t off; 316 long tinc, tsize; 317 int i, inc, j, k, toff; 318 319 KASSERT(size == vp->v_mount->mnt_stat.f_iosize, 320 ("cluster_rbuild: size %ld != f_iosize %jd\n", --- 49 unchanged lines hidden (view full) --- 370 371 TAILQ_INIT(&bp->b_cluster.cluster_head); 372 373 bp->b_bcount = 0; 374 bp->b_bufsize = 0; 375 bp->b_npages = 0; 376 377 inc = btodb(size); |
379 bo = &vp->v_bufobj; | |
380 for (bn = blkno, i = 0; i < run; ++i, bn += inc) { 381 if (i == 0) { 382 VM_OBJECT_WLOCK(tbp->b_bufobj->bo_object); 383 vfs_drain_busy_pages(tbp); 384 vm_object_pip_add(tbp->b_bufobj->bo_object, 385 tbp->b_npages); 386 for (k = 0; k < tbp->b_npages; k++) 387 vm_page_sbusy(tbp->b_pages[k]); --- 671 unchanged lines hidden --- | 378 for (bn = blkno, i = 0; i < run; ++i, bn += inc) { 379 if (i == 0) { 380 VM_OBJECT_WLOCK(tbp->b_bufobj->bo_object); 381 vfs_drain_busy_pages(tbp); 382 vm_object_pip_add(tbp->b_bufobj->bo_object, 383 tbp->b_npages); 384 for (k = 0; k < tbp->b_npages; k++) 385 vm_page_sbusy(tbp->b_pages[k]); --- 671 unchanged lines hidden --- |