FreeBSD/sys/kern/vfs_bio.c
/*
 *	vfs_bio_set_valid:
 *
 *	Set the range within the buffer to valid.  The range is
 *	relative to the beginning of the buffer, b_offset.  Note that
 *	b_offset itself may be offset from the beginning of the first
 *	page.
 */
Set the range within the buffer to valid.  The range is
relative to the beginning of the buffer, b_offset.  Note that
b_offset itself may be offset from the beginning of the first
page.
Set the range within the buffer to valid . The range is relative to the beginning of the buffer b_offset . Note that b_offset itself may be offset from the beginning of the first page .
void   
vfs_bio_set_valid(struct buf *bp, int base, int size)
{
	int i, n;
	vm_page_t m;
	if (!(bp->b_flags & B_VMIO))
		return;
	base += (bp->b_offset & PAGE_MASK);
	n = PAGE_SIZE - (base & PAGE_MASK);
	VM_OBJECT_WLOCK(bp->b_bufobj->bo_object);
	for (i = base / PAGE_SIZE; size > 0 && i < bp->b_npages; ++i) {
		m = bp->b_pages[i];
		if (n > size)
			n = size;
		vm_page_set_valid_range(m, base & PAGE_MASK, n);
		base += n;
		size -= n;
		n = PAGE_SIZE;
	}
	VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object);
}
void vfs_bio_set_valid ( struct buf * bp , int base , int size ) { int i , n ; vm_page_t m ; if ( ! ( bp -> b_flags & B_VMIO ) ) return ; base += ( bp -> b_offset & PAGE_MASK ) ; n = PAGE_SIZE - ( base & PAGE_MASK ) ; VM_OBJECT_WLOCK ( bp -> b_bufobj -> bo_object ) ; for ( i = base / PAGE_SIZE ; size > 0 && i < bp -> b_npages ; ++ i ) { m = bp -> b_pages [ i ] ; if ( n > size ) n = size ; vm_page_set_valid_range ( m , base & PAGE_MASK , n ) ; base += n ; size -= n ; n = PAGE_SIZE ; } VM_OBJECT_WUNLOCK ( bp -> b_bufobj -> bo_object ) ; }
vfs_bio_set_valid:
      Set the range within the buffer to valid.
vfs_bio_set_valid : Set the range within the buffer to valid .
/*
	 * Fixup base to be relative to beginning of first page.
	 * Set initial n to be the maximum number of bytes in the
	 * first page that can be validated.
	 */