vfs_bio.c (97919) | vfs_bio.c (98542) |
---|---|
1/* 2 * Copyright (c) 1994,1997 John S. Dyson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice immediately at the beginning of the file, without modification, 10 * this list of conditions, and the following disclaimer. 11 * 2. Absolutely no warranty of function or purpose is made by the author 12 * John S. Dyson. 13 * | 1/* 2 * Copyright (c) 1994,1997 John S. Dyson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice immediately at the beginning of the file, without modification, 10 * this list of conditions, and the following disclaimer. 11 * 2. Absolutely no warranty of function or purpose is made by the author 12 * John S. Dyson. 13 * |
14 * $FreeBSD: head/sys/kern/vfs_bio.c 97919 2002-06-06 08:56:10Z phk $ | 14 * $FreeBSD: head/sys/kern/vfs_bio.c 98542 2002-06-21 06:18:05Z mckusick $ |
15 */ 16 17/* 18 * this file contains a new buffer I/O scheme implementing a coherent 19 * VM object and buffer cache scheme. Pains have been taken to make 20 * sure that the performance degradation associated with schemes such 21 * as this is not realized. 22 * 23 * Author: John S. Dyson 24 * Significant help during the development and debugging phases 25 * had been provided by David Greenman, also of the FreeBSD core team. 26 * 27 * see man buf(9) for more info. 28 */ 29 30#include <sys/param.h> 31#include <sys/systm.h> | 15 */ 16 17/* 18 * this file contains a new buffer I/O scheme implementing a coherent 19 * VM object and buffer cache scheme. Pains have been taken to make 20 * sure that the performance degradation associated with schemes such 21 * as this is not realized. 22 * 23 * Author: John S. Dyson 24 * Significant help during the development and debugging phases 25 * had been provided by David Greenman, also of the FreeBSD core team. 26 * 27 * see man buf(9) for more info. 28 */ 29 30#include <sys/param.h> 31#include <sys/systm.h> |
32#include <sys/stdint.h> |
|
32#include <sys/bio.h> 33#include <sys/buf.h> 34#include <sys/eventhandler.h> 35#include <sys/lock.h> 36#include <sys/malloc.h> 37#include <sys/mount.h> 38#include <sys/mutex.h> 39#include <sys/kernel.h> --- 2323 unchanged lines hidden (view full) --- 2363 bsize = DEV_BSIZE; 2364 else if (vp->v_mountedhere) 2365 bsize = vp->v_mountedhere->mnt_stat.f_iosize; 2366 else if (vp->v_mount) 2367 bsize = vp->v_mount->mnt_stat.f_iosize; 2368 else 2369 bsize = size; 2370 | 33#include <sys/bio.h> 34#include <sys/buf.h> 35#include <sys/eventhandler.h> 36#include <sys/lock.h> 37#include <sys/malloc.h> 38#include <sys/mount.h> 39#include <sys/mutex.h> 40#include <sys/kernel.h> --- 2323 unchanged lines hidden (view full) --- 2364 bsize = DEV_BSIZE; 2365 else if (vp->v_mountedhere) 2366 bsize = vp->v_mountedhere->mnt_stat.f_iosize; 2367 else if (vp->v_mount) 2368 bsize = vp->v_mount->mnt_stat.f_iosize; 2369 else 2370 bsize = size; 2371 |
2371 offset = (off_t)blkno * bsize; | 2372 offset = blkno * bsize; |
2372 vmio = (VOP_GETVOBJECT(vp, NULL) == 0) && (vp->v_flag & VOBJBUF); 2373 maxsize = vmio ? size + (offset & PAGE_MASK) : size; 2374 maxsize = imax(maxsize, bsize); 2375 2376 if ((bp = getnewbuf(slpflag, slptimeo, size, maxsize)) == NULL) { 2377 if (slpflag || slptimeo) { 2378 splx(s); 2379 return NULL; --- 561 unchanged lines hidden (view full) --- 2941 */ 2942 if (m->busy == 0) { 2943 printf("biodone: page busy < 0, " 2944 "pindex: %d, foff: 0x(%x,%x), " 2945 "resid: %d, index: %d\n", 2946 (int) m->pindex, (int)(foff >> 32), 2947 (int) foff & 0xffffffff, resid, i); 2948 if (!vn_isdisk(vp, NULL)) | 2373 vmio = (VOP_GETVOBJECT(vp, NULL) == 0) && (vp->v_flag & VOBJBUF); 2374 maxsize = vmio ? size + (offset & PAGE_MASK) : size; 2375 maxsize = imax(maxsize, bsize); 2376 2377 if ((bp = getnewbuf(slpflag, slptimeo, size, maxsize)) == NULL) { 2378 if (slpflag || slptimeo) { 2379 splx(s); 2380 return NULL; --- 561 unchanged lines hidden (view full) --- 2942 */ 2943 if (m->busy == 0) { 2944 printf("biodone: page busy < 0, " 2945 "pindex: %d, foff: 0x(%x,%x), " 2946 "resid: %d, index: %d\n", 2947 (int) m->pindex, (int)(foff >> 32), 2948 (int) foff & 0xffffffff, resid, i); 2949 if (!vn_isdisk(vp, NULL)) |
2949 printf(" iosize: %ld, lblkno: %d, flags: 0x%lx, npages: %d\n", | 2950 printf(" iosize: %ld, lblkno: %lld, flags: 0x%lx, npages: %d\n", |
2950 bp->b_vp->v_mount->mnt_stat.f_iosize, | 2951 bp->b_vp->v_mount->mnt_stat.f_iosize, |
2951 (int) bp->b_lblkno, | 2952 (intmax_t) bp->b_lblkno, |
2952 bp->b_flags, bp->b_npages); 2953 else | 2953 bp->b_flags, bp->b_npages); 2954 else |
2954 printf(" VDEV, lblkno: %d, flags: 0x%lx, npages: %d\n", 2955 (int) bp->b_lblkno, | 2955 printf(" VDEV, lblkno: %lld, flags: 0x%lx, npages: %d\n", 2956 (intmax_t) bp->b_lblkno, |
2956 bp->b_flags, bp->b_npages); 2957 printf(" valid: 0x%x, dirty: 0x%x, wired: %d\n", 2958 m->valid, m->dirty, m->wire_count); 2959 panic("biodone: page busy < 0\n"); 2960 } 2961 vm_page_io_finish(m); 2962 vm_object_pip_subtract(obj, 1); 2963 foff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK; --- 367 unchanged lines hidden (view full) --- 3331 newnpages = index = (from - trunc_page((vm_offset_t)bp->b_data)) >> PAGE_SHIFT; 3332 3333 for (pg = from; pg < to; pg += PAGE_SIZE, index++) { 3334 p = bp->b_pages[index]; 3335 if (p && (index < bp->b_npages)) { 3336 if (p->busy) { 3337 printf( 3338 "vm_hold_free_pages: blkno: %lld, lblkno: %lld\n", | 2957 bp->b_flags, bp->b_npages); 2958 printf(" valid: 0x%x, dirty: 0x%x, wired: %d\n", 2959 m->valid, m->dirty, m->wire_count); 2960 panic("biodone: page busy < 0\n"); 2961 } 2962 vm_page_io_finish(m); 2963 vm_object_pip_subtract(obj, 1); 2964 foff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK; --- 367 unchanged lines hidden (view full) --- 3332 newnpages = index = (from - trunc_page((vm_offset_t)bp->b_data)) >> PAGE_SHIFT; 3333 3334 for (pg = from; pg < to; pg += PAGE_SIZE, index++) { 3335 p = bp->b_pages[index]; 3336 if (p && (index < bp->b_npages)) { 3337 if (p->busy) { 3338 printf( 3339 "vm_hold_free_pages: blkno: %lld, lblkno: %lld\n", |
3339 (long long)bp->b_blkno, 3340 (long long)bp->b_lblkno); | 3340 (intmax_t)bp->b_blkno, 3341 (intmax_t)bp->b_lblkno); |
3341 } 3342 bp->b_pages[index] = NULL; 3343 pmap_qremove(pg, 1); 3344 vm_page_busy(p); 3345 vm_page_unwire(p, 0); 3346 vm_page_free(p); 3347 } 3348 } --- 17 unchanged lines hidden (view full) --- 3366 } 3367 3368 db_printf("b_flags = 0x%b\n", (u_int)bp->b_flags, PRINT_BUF_FLAGS); 3369 db_printf( 3370 "b_error = %d, b_bufsize = %ld, b_bcount = %ld, b_resid = %ld\n" 3371 "b_dev = (%d,%d), b_data = %p, b_blkno = %lld, b_pblkno = %lld\n", 3372 bp->b_error, bp->b_bufsize, bp->b_bcount, bp->b_resid, 3373 major(bp->b_dev), minor(bp->b_dev), bp->b_data, | 3342 } 3343 bp->b_pages[index] = NULL; 3344 pmap_qremove(pg, 1); 3345 vm_page_busy(p); 3346 vm_page_unwire(p, 0); 3347 vm_page_free(p); 3348 } 3349 } --- 17 unchanged lines hidden (view full) --- 3367 } 3368 3369 db_printf("b_flags = 0x%b\n", (u_int)bp->b_flags, PRINT_BUF_FLAGS); 3370 db_printf( 3371 "b_error = %d, b_bufsize = %ld, b_bcount = %ld, b_resid = %ld\n" 3372 "b_dev = (%d,%d), b_data = %p, b_blkno = %lld, b_pblkno = %lld\n", 3373 bp->b_error, bp->b_bufsize, bp->b_bcount, bp->b_resid, 3374 major(bp->b_dev), minor(bp->b_dev), bp->b_data, |
3374 (long long)bp->b_blkno, (long long)bp->b_pblkno); | 3375 (intmax_t)bp->b_blkno, (intmax_t)bp->b_pblkno); |
3375 if (bp->b_npages) { 3376 int i; 3377 db_printf("b_npages = %d, pages(OBJ, IDX, PA): ", bp->b_npages); 3378 for (i = 0; i < bp->b_npages; i++) { 3379 vm_page_t m; 3380 m = bp->b_pages[i]; 3381 db_printf("(%p, 0x%lx, 0x%lx)", (void *)m->object, 3382 (u_long)m->pindex, (u_long)VM_PAGE_TO_PHYS(m)); 3383 if ((i + 1) < bp->b_npages) 3384 db_printf(","); 3385 } 3386 db_printf("\n"); 3387 } 3388} 3389#endif /* DDB */ | 3376 if (bp->b_npages) { 3377 int i; 3378 db_printf("b_npages = %d, pages(OBJ, IDX, PA): ", bp->b_npages); 3379 for (i = 0; i < bp->b_npages; i++) { 3380 vm_page_t m; 3381 m = bp->b_pages[i]; 3382 db_printf("(%p, 0x%lx, 0x%lx)", (void *)m->object, 3383 (u_long)m->pindex, (u_long)VM_PAGE_TO_PHYS(m)); 3384 if ((i + 1) < bp->b_npages) 3385 db_printf(","); 3386 } 3387 db_printf("\n"); 3388 } 3389} 3390#endif /* DDB */ |