FreeBSD/sys/kern/vfs_bio.c
/*
 * Set the dirty range for a buffer based on the status of the dirty
 * bits in the pages comprising the buffer.  The range is limited
 * to the size of the buffer.
 *
 * Tell the VM system that the pages associated with this buffer
 * are clean.  This is used for delayed writes where the data is
 * going to go to disk eventually without additional VM intevention.
 *
 * Note that while we only really need to clean through to b_bcount, we
 * just go ahead and clean through to b_bufsize.
 */
Set the dirty range for a buffer based on the status of the dirty
bits in the pages comprising the buffer.  The range is limited
to the size of the buffer.

Tell the VM system that the pages associated with this buffer
are clean.  This is used for delayed writes where the data is
going to go to disk eventually without additional VM intevention.

Note that while we only really need to clean through to b_bcount, we
just go ahead and clean through to b_bufsize.
Set the dirty range for a buffer based on the status of the dirty bits in the pages comprising the buffer . The range is limited to the size of the buffer . Tell the VM system that the pages associated with this buffer are clean . This is used for delayed writes where the data is going to go to disk eventually without additional VM intevention . Note that while we only really need to clean through to b_bcount we just go ahead and clean through to b_bufsize .
static void
vfs_clean_pages_dirty_buf(struct buf *bp)
{
	vm_ooffset_t foff, noff, eoff;
	vm_page_t m;
	int i;
	if ((bp->b_flags & B_VMIO) == 0 || bp->b_bufsize == 0)
		return;
	foff = bp->b_offset;
	KASSERT(bp->b_offset != NOOFFSET,
	    ("vfs_clean_pages_dirty_buf: no buffer offset"));
	VM_OBJECT_WLOCK(bp->b_bufobj->bo_object);
	vfs_drain_busy_pages(bp);
	vfs_setdirty_locked_object(bp);
	for (i = 0; i < bp->b_npages; i++) {
		noff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK;
		eoff = noff;
		if (eoff > bp->b_offset + bp->b_bufsize)
			eoff = bp->b_offset + bp->b_bufsize;
		m = bp->b_pages[i];
		vfs_page_set_validclean(bp, foff, m);
		foff = noff;
	}
	VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object);
}
static void vfs_clean_pages_dirty_buf ( struct buf * bp ) { vm_ooffset_t foff , noff , eoff ; vm_page_t m ; int i ; if ( ( bp -> b_flags & B_VMIO ) == 0 || bp -> b_bufsize == 0 ) return ; foff = bp -> b_offset ; KASSERT ( bp -> b_offset != NOOFFSET , ( " " ) ) ; VM_OBJECT_WLOCK ( bp -> b_bufobj -> bo_object ) ; vfs_drain_busy_pages ( bp ) ; vfs_setdirty_locked_object ( bp ) ; for ( i = 0 ; i < bp -> b_npages ; i ++ ) { noff = ( foff + PAGE_SIZE ) & ~ ( off_t ) PAGE_MASK ; eoff = noff ; if ( eoff > bp -> b_offset + bp -> b_bufsize ) eoff = bp -> b_offset + bp -> b_bufsize ; m = bp -> b_pages [ i ] ; vfs_page_set_validclean ( bp , foff , m ) ; foff = noff ; } VM_OBJECT_WUNLOCK ( bp -> b_bufobj -> bo_object ) ; }
Set the dirty range for a buffer based on the status of the dirty
 bits in the pages comprising the buffer.
Set the dirty range for a buffer based on the status of the dirty bits in the pages comprising the buffer .
/* vm_page_clear_dirty(m, foff & PAGE_MASK, eoff - foff); */