FreeBSD/sys/kern/vfs_bio.c
/*
 * This routine is called in lieu of iodone in the case of
 * incomplete I/O.  This keeps the busy status for pages
 * consistent.
 */
This routine is called in lieu of iodone in the case of
incomplete I/O.  This keeps the busy status for pages
consistent.
This routine is called in lieu of iodone in the case of incomplete I / O . This keeps the busy status for pages consistent .
void
vfs_unbusy_pages(struct buf *bp)
{
	int i;
	vm_object_t obj;
	vm_page_t m;
	runningbufwakeup(bp);
	if (!(bp->b_flags & B_VMIO))
		return;
	obj = bp->b_bufobj->bo_object;
	VM_OBJECT_WLOCK(obj);
	for (i = 0; i < bp->b_npages; i++) {
		m = bp->b_pages[i];
		if (m == bogus_page) {
			m = vm_page_lookup(obj, OFF_TO_IDX(bp->b_offset) + i);
			if (!m)
				panic("vfs_unbusy_pages: page missing\n");
			bp->b_pages[i] = m;
			if (buf_mapped(bp)) {
				BUF_CHECK_MAPPED(bp);
				pmap_qenter(trunc_page((vm_offset_t)bp->b_data),
				    bp->b_pages, bp->b_npages);
			} else
				BUF_CHECK_UNMAPPED(bp);
		}
		vm_page_sunbusy(m);
	}
	vm_object_pip_wakeupn(obj, bp->b_npages);
	VM_OBJECT_WUNLOCK(obj);
}
void vfs_unbusy_pages ( struct buf * bp ) { int i ; vm_object_t obj ; vm_page_t m ; runningbufwakeup ( bp ) ; if ( ! ( bp -> b_flags & B_VMIO ) ) return ; obj = bp -> b_bufobj -> bo_object ; VM_OBJECT_WLOCK ( obj ) ; for ( i = 0 ; i < bp -> b_npages ; i ++ ) { m = bp -> b_pages [ i ] ; if ( m == bogus_page ) { m = vm_page_lookup ( obj , OFF_TO_IDX ( bp -> b_offset ) + i ) ; if ( ! m ) panic ( " \n " ) ; bp -> b_pages [ i ] = m ; if ( buf_mapped ( bp ) ) { BUF_CHECK_MAPPED ( bp ) ; pmap_qenter ( trunc_page ( ( vm_offset_t ) bp -> b_data ) , bp -> b_pages , bp -> b_npages ) ; } else BUF_CHECK_UNMAPPED ( bp ) ; } vm_page_sunbusy ( m ) ; } vm_object_pip_wakeupn ( obj , bp -> b_npages ) ; VM_OBJECT_WUNLOCK ( obj ) ; }
This routine is called in lieu of iodone in the case of
 incomplete I/O.
This routine is called in lieu of iodone in the case of incomplete I / O .