FreeBSD/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
/*
 * When a file is memory mapped, we must keep the IO data synchronized
 * between the DMU cache and the memory mapped pages.  What this means:
 *
 * On Write:	If we find a memory mapped page, we write to *both*
 *		the page and the dmu buffer.
 */
When a file is memory mapped, we must keep the IO data synchronized
between the DMU cache and the memory mapped pages.  What this means.

On Write:    If we find a memory mapped page, we write to *both
the page and the dmu buffer.
When a file is memory mapped we must keep the IO data synchronized between the DMU cache and the memory mapped pages . What this means . On Write : If we find a memory mapped page we write to * both the page and the dmu buffer .
static void
update_pages(vnode_t *vp, int64_t start, int len, objset_t *os, uint64_t oid,
    int segflg, dmu_tx_t *tx)
{
	vm_object_t obj;
	struct sf_buf *sf;
	caddr_t va;
	int off;
	ASSERT(segflg != UIO_NOCOPY);
	ASSERT(vp->v_mount != NULL);
	obj = vp->v_object;
	ASSERT(obj != NULL);
	off = start & PAGEOFFSET;
	zfs_vmobject_wlock(obj);
	for (start &= PAGEMASK; len > 0; start += PAGESIZE) {
		vm_page_t pp;
		int nbytes = imin(PAGESIZE - off, len);
		if ((pp = page_busy(vp, start, off, nbytes)) != NULL) {
			zfs_vmobject_wunlock(obj);
			va = zfs_map_page(pp, &sf);
			(void) dmu_read(os, oid, start+off, nbytes,
			    va+off, DMU_READ_PREFETCH);;
			zfs_unmap_page(sf);
			zfs_vmobject_wlock(obj);
			page_unbusy(pp);
		}
		len -= nbytes;
		off = 0;
	}
	vm_object_pip_wakeupn(obj, 0);
	zfs_vmobject_wunlock(obj);
}
static void update_pages ( vnode_t * vp , int64_t start , int len , objset_t * os , uint64_t oid , int segflg , dmu_tx_t * tx ) { vm_object_t obj ; struct sf_buf * sf ; caddr_t va ; int off ; ASSERT ( segflg != UIO_NOCOPY ) ; ASSERT ( vp -> v_mount != NULL ) ; obj = vp -> v_object ; ASSERT ( obj != NULL ) ; off = start & PAGEOFFSET ; zfs_vmobject_wlock ( obj ) ; for ( start &= PAGEMASK ; len > 0 ; start += PAGESIZE ) { vm_page_t pp ; int nbytes = imin ( PAGESIZE - off , len ) ; if ( ( pp = page_busy ( vp , start , off , nbytes ) ) != NULL ) { zfs_vmobject_wunlock ( obj ) ; va = zfs_map_page ( pp , & sf ) ; ( void ) dmu_read ( os , oid , start + off , nbytes , va + off , DMU_READ_PREFETCH ) ; ; zfs_unmap_page ( sf ) ; zfs_vmobject_wlock ( obj ) ; page_unbusy ( pp ) ; } len -= nbytes ; off = 0 ; } vm_object_pip_wakeupn ( obj , 0 ) ; zfs_vmobject_wunlock ( obj ) ; }
When a file is memory mapped, we must keep the IO data synchronized
 between the DMU cache and the memory mapped pages.
When a file is memory mapped we must keep the IO data synchronized between the DMU cache and the memory mapped pages .