* Populate the specified range of the object with valid pages. Returns * TRUE if the range is successfully populated and FALSE otherwise. * * Note: This function should be optimized to pass a larger array of * pages to vm_pager_get_pages() before it is applied to a non- * OBJT_DEVICE object. * * The object must be locked. */
| 2193 | * The object must be locked. |
| 2194 | */ |
| 2195 | boolean_t |
| 2196 | vm_object_populate(vm_object_t object, vm_pindex_t start, vm_pindex_t end) |
| 2197 | { |
| 2198 | vm_page_t m; |
| 2199 | vm_pindex_t pindex; |
| 2200 | int rv; |
| 2201 | |
| 2202 | VM_OBJECT_ASSERT_WLOCKED(object); |
| 2203 | for (pindex = start; pindex < end; pindex++) { |
| 2204 | rv = vm_page_grab_valid(&m, object, pindex, VM_ALLOC_NORMAL); |
| 2205 | if (rv != VM_PAGER_OK) |
| 2206 | break; |
| 2207 | |
| 2208 | /* |
| 2209 | * Keep "m" busy because a subsequent iteration may unlock |
| 2210 | * the object. |
| 2211 | */ |
| 2212 | } |
| 2213 | if (pindex > start) { |
| 2214 | m = vm_page_lookup(object, start); |
| 2215 | while (m != NULL && m->pindex < pindex) { |
| 2216 | vm_page_xunbusy(m); |
| 2217 | m = TAILQ_NEXT(m, listq); |
| 2218 | } |
| 2219 | } |
| 2220 | return (pindex == end); |
| 2221 | } |
| 2222 | |
| 2223 | /* |
| 2224 | * Routine: vm_object_coalesce |
no test coverage detected