MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vm_hold_load_pages

Function vm_hold_load_pages

freebsd/kern/vfs_bio.c:4878–4908  ·  view source on GitHub ↗

* vm_hold_load_pages and vm_hold_free_pages get pages into * a buffers address space. The pages are anonymous and are * not associated with a file object. */

Source from the content-addressed store, hash-verified

4876 * not associated with a file object.
4877 */
4878static void
4879vm_hold_load_pages(struct buf *bp, vm_offset_t from, vm_offset_t to)
4880{
4881 vm_offset_t pg;
4882 vm_page_t p;
4883 int index;
4884
4885 BUF_CHECK_MAPPED(bp);
4886
4887 to = round_page(to);
4888 from = round_page(from);
4889 index = (from - trunc_page((vm_offset_t)bp->b_data)) >> PAGE_SHIFT;
4890 MPASS((bp->b_flags & B_MAXPHYS) == 0);
4891 KASSERT(to - from <= maxbcachebuf,
4892 ("vm_hold_load_pages too large %p %#jx %#jx %u",
4893 bp, (uintmax_t)from, (uintmax_t)to, maxbcachebuf));
4894
4895 for (pg = from; pg < to; pg += PAGE_SIZE, index++) {
4896 /*
4897 * note: must allocate system pages since blocking here
4898 * could interfere with paging I/O, no matter which
4899 * process we are.
4900 */
4901 p = vm_page_alloc(NULL, 0, VM_ALLOC_SYSTEM | VM_ALLOC_NOOBJ |
4902 VM_ALLOC_WIRED | VM_ALLOC_COUNT((to - pg) >> PAGE_SHIFT) |
4903 VM_ALLOC_WAITOK);
4904 pmap_qenter(pg, &p, 1);
4905 bp->b_pages[index] = p;
4906 }
4907 bp->b_npages = index;
4908}
4909
4910/* Return pages associated with this buf to the vm system */
4911static void

Callers 1

vfs_nonvmio_extendFunction · 0.85

Calls 2

vm_page_allocFunction · 0.85
pmap_qenterFunction · 0.50

Tested by

no test coverage detected