FreeBSD/sys/kern/vfs_bio.c
/*
 * Ensure that all buffer pages are not exclusive busied.  If any page is
 * exclusive busy, drain it.
 */
Ensure that all buffer pages are not exclusive busied.  If any page is
exclusive busy, drain it.
Ensure that all buffer pages are not exclusive busied . If any page is exclusive busy drain it .
void
vfs_drain_busy_pages(struct buf *bp)
{
	vm_page_t m;
	int i, last_busied;
	VM_OBJECT_ASSERT_WLOCKED(bp->b_bufobj->bo_object);
	last_busied = 0;
	for (i = 0; i < bp->b_npages; i++) {
		m = bp->b_pages[i];
		if (vm_page_xbusied(m)) {
			for (; last_busied < i; last_busied++)
				vm_page_sbusy(bp->b_pages[last_busied]);
			while (vm_page_xbusied(m)) {
				vm_page_lock(m);
				VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object);
				vm_page_busy_sleep(m, "vbpage");
				VM_OBJECT_WLOCK(bp->b_bufobj->bo_object);
			}
		}
	}
	for (i = 0; i < last_busied; i++)
		vm_page_sunbusy(bp->b_pages[i]);
}
void vfs_drain_busy_pages ( struct buf * bp ) { vm_page_t m ; int i , last_busied ; VM_OBJECT_ASSERT_WLOCKED ( bp -> b_bufobj -> bo_object ) ; last_busied = 0 ; for ( i = 0 ; i < bp -> b_npages ; i ++ ) { m = bp -> b_pages [ i ] ; if ( vm_page_xbusied ( m ) ) { for ( ; last_busied < i ; last_busied ++ ) vm_page_sbusy ( bp -> b_pages [ last_busied ] ) ; while ( vm_page_xbusied ( m ) ) { vm_page_lock ( m ) ; VM_OBJECT_WUNLOCK ( bp -> b_bufobj -> bo_object ) ; vm_page_busy_sleep ( m , " " ) ; VM_OBJECT_WLOCK ( bp -> b_bufobj -> bo_object ) ; } } } for ( i = 0 ; i < last_busied ; i ++ ) vm_page_sunbusy ( bp -> b_pages [ i ] ) ; }
Ensure that all buffer pages are not exclusive busied.
Ensure that all buffer pages are not exclusive busied .