FreeBSD/sys/kern/vfs_bio.c
/*
 * vfs_page_set_valid:
 *
 *	Set the valid bits in a page based on the supplied offset.   The
 *	range is restricted to the buffer's size.
 *
 *	This routine is typically called after a read completes.
 */
Set the valid bits in a page based on the supplied offset.   The
range is restricted to the buffer's size.

This routine is typically called after a read completes.
Set the valid bits in a page based on the supplied offset . The range is restricted to the buffer ' s size . This routine is typically called after a read completes .
static void
vfs_page_set_valid(struct buf *bp, vm_ooffset_t off, vm_page_t m)
{
	vm_ooffset_t eoff;
	eoff = (off + PAGE_SIZE) & ~(vm_ooffset_t)PAGE_MASK;
	if (eoff > bp->b_offset + bp->b_bcount)
		eoff = bp->b_offset + bp->b_bcount;
	if (eoff > off)
		vm_page_set_valid_range(m, off & PAGE_MASK, eoff - off);
}
static void vfs_page_set_valid ( struct buf * bp , vm_ooffset_t off , vm_page_t m ) { vm_ooffset_t eoff ; eoff = ( off + PAGE_SIZE ) & ~ ( vm_ooffset_t ) PAGE_MASK ; if ( eoff > bp -> b_offset + bp -> b_bcount ) eoff = bp -> b_offset + bp -> b_bcount ; if ( eoff > off ) vm_page_set_valid_range ( m , off & PAGE_MASK , eoff - off ) ; }
vfs_page_set_valid:
      Set the valid bits in a page based on the supplied offset.
vfs_page_set_valid : Set the valid bits in a page based on the supplied offset .
/*
	 * Compute the end offset, eoff, such that [off, eoff) does not span a
	 * page boundary and eoff is not greater than the end of the buffer.
	 * The end of the buffer, in this case, is our file EOF, not the
	 * allocation size of the buffer.
	 */ /*
	 * Set valid range.  This is typically the entire buffer and thus the
	 * entire page.
	 */