+#if USE_PRECIOUS
+ request_flags = UPL_NO_SYNC | UPL_CLEAN_IN_PLACE | UPL_PRECIOUS | UPL_RET_ONLY_ABSENT | UPL_SET_LITE;
+#else
+ request_flags = UPL_NO_SYNC | UPL_CLEAN_IN_PLACE | UPL_RET_ONLY_ABSENT | UPL_SET_LITE;
+#endif
+ cl_index = (vs_offset & cl_mask) / vm_page_size;
+
+ if ((ps_clmap(vs, vs_offset & ~cl_mask, &clmap, CL_FIND, 0, 0) == (dp_offset_t)-1) ||
+ !CLMAP_ISSET(clmap, cl_index)) {
+ /*
+ * the needed page doesn't exist in the backing store...
+ * we don't want to try to do any I/O, just abort the
+ * page and let the fault handler provide a zero-fill
+ */
+ if (cnt == 0) {
+ /*
+ * The caller was just poking at us to see if
+ * the page has been paged out. No need to
+ * mess with the page at all.
+ * Just let the caller know we don't have that page.
+ */
+ return KERN_FAILURE;
+ }
+
+ page_list_count = 0;
+
+ memory_object_super_upl_request(vs->vs_control, (memory_object_offset_t)vs_offset,
+ PAGE_SIZE, PAGE_SIZE,
+ &upl, NULL, &page_list_count,
+ request_flags);
+
+ if (clmap.cl_error)
+ upl_abort(upl, UPL_ABORT_ERROR);
+ else
+ upl_abort(upl, UPL_ABORT_UNAVAILABLE);
+ upl_deallocate(upl);
+
+ return KERN_SUCCESS;
+ }
+
+ if (cnt == 0) {
+ /*
+ * The caller was just poking at us to see if
+ * the page has been paged out. No need to
+ * mess with the page at all.
+ * Just let the caller know we do have that page.
+ */
+ return KERN_SUCCESS;
+ }
+
+ assert(dp_encryption_inited);
+ if (dp_encryption) {
+ /*
+ * ENCRYPTED SWAP:
+ * request that the UPL be prepared for
+ * decryption.
+ */
+ request_flags |= UPL_ENCRYPT;
+ }
+ orig_vs_offset = vs_offset;
+
+ assert(cnt != 0);
+ cnt = VM_SUPER_CLUSTER;
+ cluster_start = (memory_object_offset_t) vs_offset;
+ cluster_length = (vm_size_t) cnt;
+ io_streaming = 0;
+
+ /*
+ * determine how big a speculative I/O we should try for...
+ */
+ if (memory_object_cluster_size(vs->vs_control, &cluster_start, &cluster_length, &io_streaming, (memory_object_fault_info_t)fault_info) == KERN_SUCCESS) {
+ assert(vs_offset >= (dp_offset_t) cluster_start &&
+ vs_offset < (dp_offset_t) (cluster_start + cluster_length));
+ vs_offset = (dp_offset_t) cluster_start;
+ cnt = (dp_size_t) cluster_length;
+ } else {
+ cluster_length = PAGE_SIZE;
+ cnt = PAGE_SIZE;
+ }
+
+ if (io_streaming)
+ io_flags |= UPL_IOSTREAMING;
+
+ last_start = cluster_start;
+ last_length = cluster_length;
+