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

Function vm_page_set_invalid

freebsd/vm/vm_page.c:5212–5243  ·  view source on GitHub ↗

* vm_page_set_invalid: * * Invalidates DEV_BSIZE'd chunks within a page. Both the * valid and dirty bits for the effected areas are cleared. */

Source from the content-addressed store, hash-verified

5210 * valid and dirty bits for the effected areas are cleared.
5211 */
5212void
5213vm_page_set_invalid(vm_page_t m, int base, int size)
5214{
5215 vm_page_bits_t bits;
5216 vm_object_t object;
5217
5218 /*
5219 * The object lock is required so that pages can't be mapped
5220 * read-only while we're in the process of invalidating them.
5221 */
5222 object = m->object;
5223 VM_OBJECT_ASSERT_WLOCKED(object);
5224 vm_page_assert_busied(m);
5225
5226 if (object->type == OBJT_VNODE && base == 0 && IDX_TO_OFF(m->pindex) +
5227 size >= object->un_pager.vnp.vnp_size)
5228 bits = VM_PAGE_BITS_ALL;
5229 else
5230 bits = vm_page_bits(base, size);
5231 if (object->ref_count != 0 && vm_page_all_valid(m) && bits != 0)
5232 pmap_remove_all(m);
5233 KASSERT((bits == 0 && vm_page_all_valid(m)) ||
5234 !pmap_page_is_mapped(m),
5235 ("vm_page_set_invalid: page %p is mapped", m));
5236 if (vm_page_xbusied(m)) {
5237 m->valid &= ~bits;
5238 m->dirty &= ~bits;
5239 } else {
5240 vm_page_bits_clear(m, &m->valid, bits);
5241 vm_page_bits_clear(m, &m->dirty, bits);
5242 }
5243}
5244
5245/*
5246 * vm_page_invalid:

Callers 1

vfs_vmio_invalidateFunction · 0.85

Calls 5

vm_page_bitsFunction · 0.85
vm_page_all_validFunction · 0.85
vm_page_bits_clearFunction · 0.85
pmap_remove_allFunction · 0.50
pmap_page_is_mappedFunction · 0.50

Tested by

no test coverage detected