vfs_bio.c (137186) | vfs_bio.c (137188) |
---|---|
1/*- 2 * Copyright (c) 2004 Poul-Henning Kamp 3 * Copyright (c) 1994,1997 John S. Dyson 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 25 unchanged lines hidden (view full) --- 34 * Author: John S. Dyson 35 * Significant help during the development and debugging phases 36 * had been provided by David Greenman, also of the FreeBSD core team. 37 * 38 * see man buf(9) for more info. 39 */ 40 41#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2004 Poul-Henning Kamp 3 * Copyright (c) 1994,1997 John S. Dyson 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 25 unchanged lines hidden (view full) --- 34 * Author: John S. Dyson 35 * Significant help during the development and debugging phases 36 * had been provided by David Greenman, also of the FreeBSD core team. 37 * 38 * see man buf(9) for more info. 39 */ 40 41#include <sys/cdefs.h> |
42__FBSDID("$FreeBSD: head/sys/kern/vfs_bio.c 137186 2004-11-04 07:59:57Z phk $"); | 42__FBSDID("$FreeBSD: head/sys/kern/vfs_bio.c 137188 2004-11-04 08:25:52Z phk $"); |
43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/bio.h> 47#include <sys/conf.h> 48#include <sys/buf.h> 49#include <sys/devicestat.h> 50#include <sys/eventhandler.h> --- 33 unchanged lines hidden (view full) --- 84/* 85 * XXX buf is global because kern_shutdown.c and ffs_checkoverlap has 86 * carnal knowledge of buffers. This knowledge should be moved to vfs_bio.c. 87 */ 88struct buf *buf; /* buffer header pool */ 89 90static struct proc *bufdaemonproc; 91 | 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/bio.h> 47#include <sys/conf.h> 48#include <sys/buf.h> 49#include <sys/devicestat.h> 50#include <sys/eventhandler.h> --- 33 unchanged lines hidden (view full) --- 84/* 85 * XXX buf is global because kern_shutdown.c and ffs_checkoverlap has 86 * carnal knowledge of buffers. This knowledge should be moved to vfs_bio.c. 87 */ 88struct buf *buf; /* buffer header pool */ 89 90static struct proc *bufdaemonproc; 91 |
92static int inmem(struct vnode * vp, daddr_t blkno); | 92static int inmem(struct vnode *vp, daddr_t blkno); |
93static void vm_hold_free_pages(struct buf *bp, vm_offset_t from, 94 vm_offset_t to); 95static void vm_hold_load_pages(struct buf *bp, vm_offset_t from, 96 vm_offset_t to); 97static void vfs_page_set_valid(struct buf *bp, vm_ooffset_t off, 98 int pageno, vm_page_t m); 99static void vfs_clean_pages(struct buf *bp); 100static void vfs_setdirty(struct buf *bp); --- 3425 unchanged lines hidden (view full) --- 3526 3527 base += (bp->b_offset & PAGE_MASK); 3528 n = PAGE_SIZE - (base & PAGE_MASK); 3529 3530 VM_OBJECT_LOCK(bp->b_bufobj->bo_object); 3531 vm_page_lock_queues(); 3532 for (i = base / PAGE_SIZE; size > 0 && i < bp->b_npages; ++i) { 3533 m = bp->b_pages[i]; | 93static void vm_hold_free_pages(struct buf *bp, vm_offset_t from, 94 vm_offset_t to); 95static void vm_hold_load_pages(struct buf *bp, vm_offset_t from, 96 vm_offset_t to); 97static void vfs_page_set_valid(struct buf *bp, vm_ooffset_t off, 98 int pageno, vm_page_t m); 99static void vfs_clean_pages(struct buf *bp); 100static void vfs_setdirty(struct buf *bp); --- 3425 unchanged lines hidden (view full) --- 3526 3527 base += (bp->b_offset & PAGE_MASK); 3528 n = PAGE_SIZE - (base & PAGE_MASK); 3529 3530 VM_OBJECT_LOCK(bp->b_bufobj->bo_object); 3531 vm_page_lock_queues(); 3532 for (i = base / PAGE_SIZE; size > 0 && i < bp->b_npages; ++i) { 3533 m = bp->b_pages[i]; |
3534 | |
3535 if (n > size) 3536 n = size; | 3534 if (n > size) 3535 n = size; |
3537 | |
3538 vm_page_set_validclean(m, base & PAGE_MASK, n); 3539 base += n; 3540 size -= n; 3541 n = PAGE_SIZE; 3542 } 3543 vm_page_unlock_queues(); 3544 VM_OBJECT_UNLOCK(bp->b_bufobj->bo_object); 3545} --- 52 unchanged lines hidden (view full) --- 3598 if ((bp->b_pages[i]->valid & mask) == mask) 3599 continue; 3600 if ((bp->b_pages[i]->valid & mask) == 0) { 3601 if ((bp->b_pages[i]->flags & PG_ZERO) == 0) 3602 bzero(sa, ea - sa); 3603 } else { 3604 for (; sa < ea; sa += DEV_BSIZE, j++) { 3605 if (((bp->b_pages[i]->flags & PG_ZERO) == 0) && | 3536 vm_page_set_validclean(m, base & PAGE_MASK, n); 3537 base += n; 3538 size -= n; 3539 n = PAGE_SIZE; 3540 } 3541 vm_page_unlock_queues(); 3542 VM_OBJECT_UNLOCK(bp->b_bufobj->bo_object); 3543} --- 52 unchanged lines hidden (view full) --- 3596 if ((bp->b_pages[i]->valid & mask) == mask) 3597 continue; 3598 if ((bp->b_pages[i]->valid & mask) == 0) { 3599 if ((bp->b_pages[i]->flags & PG_ZERO) == 0) 3600 bzero(sa, ea - sa); 3601 } else { 3602 for (; sa < ea; sa += DEV_BSIZE, j++) { 3603 if (((bp->b_pages[i]->flags & PG_ZERO) == 0) && |
3606 (bp->b_pages[i]->valid & (1<<j)) == 0) | 3604 (bp->b_pages[i]->valid & (1 << j)) == 0) |
3607 bzero(sa, DEV_BSIZE); 3608 } 3609 } 3610 bp->b_pages[i]->valid |= mask; 3611 } 3612unlock: 3613 VM_OBJECT_UNLOCK(bp->b_bufobj->bo_object); 3614 bp->b_resid = 0; --- 275 unchanged lines hidden --- | 3605 bzero(sa, DEV_BSIZE); 3606 } 3607 } 3608 bp->b_pages[i]->valid |= mask; 3609 } 3610unlock: 3611 VM_OBJECT_UNLOCK(bp->b_bufobj->bo_object); 3612 bp->b_resid = 0; --- 275 unchanged lines hidden --- |