swap_pager.c (2828dafcf3e7b225b70cbb380eb8c7dae452493e) | swap_pager.c (7667839a7ec4354de9984d411c45cbacf9fe8e3b) |
---|---|
1/*- 2 * Copyright (c) 1998 Matthew Dillon, 3 * Copyright (c) 1994 John S. Dyson 4 * Copyright (c) 1990 University of Utah. 5 * Copyright (c) 1982, 1986, 1989, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by --- 1112 unchanged lines hidden (view full) --- 1121 1122 /* 1123 * Allocate readahead and readbehind pages. 1124 */ 1125 shift = rbehind != NULL ? *rbehind : 0; 1126 if (shift != 0) { 1127 for (i = 1; i <= shift; i++) { 1128 p = vm_page_alloc(object, m[0]->pindex - i, | 1/*- 2 * Copyright (c) 1998 Matthew Dillon, 3 * Copyright (c) 1994 John S. Dyson 4 * Copyright (c) 1990 University of Utah. 5 * Copyright (c) 1982, 1986, 1989, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by --- 1112 unchanged lines hidden (view full) --- 1121 1122 /* 1123 * Allocate readahead and readbehind pages. 1124 */ 1125 shift = rbehind != NULL ? *rbehind : 0; 1126 if (shift != 0) { 1127 for (i = 1; i <= shift; i++) { 1128 p = vm_page_alloc(object, m[0]->pindex - i, |
1129 VM_ALLOC_NORMAL | VM_ALLOC_IFNOTCACHED); | 1129 VM_ALLOC_NORMAL); |
1130 if (p == NULL) { 1131 /* Shift allocated pages to the left. */ 1132 for (j = 0; j < i - 1; j++) 1133 bp->b_pages[j] = 1134 bp->b_pages[j + shift - i + 1]; 1135 break; 1136 } 1137 bp->b_pages[shift - i] = p; 1138 } 1139 shift = i - 1; 1140 *rbehind = shift; 1141 } 1142 for (i = 0; i < reqcount; i++) 1143 bp->b_pages[i + shift] = m[i]; 1144 if (rahead != NULL) { 1145 for (i = 0; i < *rahead; i++) { 1146 p = vm_page_alloc(object, | 1130 if (p == NULL) { 1131 /* Shift allocated pages to the left. */ 1132 for (j = 0; j < i - 1; j++) 1133 bp->b_pages[j] = 1134 bp->b_pages[j + shift - i + 1]; 1135 break; 1136 } 1137 bp->b_pages[shift - i] = p; 1138 } 1139 shift = i - 1; 1140 *rbehind = shift; 1141 } 1142 for (i = 0; i < reqcount; i++) 1143 bp->b_pages[i + shift] = m[i]; 1144 if (rahead != NULL) { 1145 for (i = 0; i < *rahead; i++) { 1146 p = vm_page_alloc(object, |
1147 m[reqcount - 1]->pindex + i + 1, 1148 VM_ALLOC_NORMAL | VM_ALLOC_IFNOTCACHED); | 1147 m[reqcount - 1]->pindex + i + 1, VM_ALLOC_NORMAL); |
1149 if (p == NULL) 1150 break; 1151 bp->b_pages[shift + reqcount + i] = p; 1152 } 1153 *rahead = i; 1154 } 1155 if (rbehind != NULL) 1156 count += *rbehind; --- 1625 unchanged lines hidden --- | 1148 if (p == NULL) 1149 break; 1150 bp->b_pages[shift + reqcount + i] = p; 1151 } 1152 *rahead = i; 1153 } 1154 if (rbehind != NULL) 1155 count += *rbehind; --- 1625 unchanged lines hidden --- |