FreeBSD/sys/kern/vfs_bio.c
/* Return pages associated with this buf to the vm system */
Return pages associated with this buf to the vm system
Return pages associated with this buf to the vm system
static void
vm_hold_free_pages(struct buf *bp, int newbsize)
{
	vm_offset_t from;
	vm_page_t p;
	int index, newnpages;
	BUF_CHECK_MAPPED(bp);
	from = round_page((vm_offset_t)bp->b_data + newbsize);
	newnpages = (from - trunc_page((vm_offset_t)bp->b_data)) >> PAGE_SHIFT;
	if (bp->b_npages > newnpages)
		pmap_qremove(from, bp->b_npages - newnpages);
	for (index = newnpages; index < bp->b_npages; index++) {
		p = bp->b_pages[index];
		bp->b_pages[index] = NULL;
		if (vm_page_sbusied(p))
			printf("vm_hold_free_pages: blkno: %jd, lblkno: %jd\n",
			    (intmax_t)bp->b_blkno, (intmax_t)bp->b_lblkno);
		p->wire_count--;
		vm_page_free(p);
		atomic_subtract_int(&vm_cnt.v_wire_count, 1);
	}
	bp->b_npages = newnpages;
}
static void vm_hold_free_pages ( struct buf * bp , int newbsize ) { vm_offset_t from ; vm_page_t p ; int index , newnpages ; BUF_CHECK_MAPPED ( bp ) ; from = round_page ( ( vm_offset_t ) bp -> b_data + newbsize ) ; newnpages = ( from - trunc_page ( ( vm_offset_t ) bp -> b_data ) ) >> PAGE_SHIFT ; if ( bp -> b_npages > newnpages ) pmap_qremove ( from , bp -> b_npages - newnpages ) ; for ( index = newnpages ; index < bp -> b_npages ; index ++ ) { p = bp -> b_pages [ index ] ; bp -> b_pages [ index ] = NULL ; if ( vm_page_sbusied ( p ) ) printf ( " \n " , ( intmax_t ) bp -> b_blkno , ( intmax_t ) bp -> b_lblkno ) ; p -> wire_count -- ; vm_page_free ( p ) ; atomic_subtract_int ( & vm_cnt . v_wire_count , 1 ) ; } bp -> b_npages = newnpages ; }
Return pages associated with this buf to the vm system
Return pages associated with this buf to the vm system