Have sendfile_swapin() use vm_page_grab_pages().
Reviewed by: alc, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D11942
This commit is contained in:
parent
9df950b35d
commit
af0460beda
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=322406
@ -309,7 +309,7 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, off_t off, off_t len,
|
||||
int npages, int rhpages, int flags)
|
||||
{
|
||||
vm_page_t *pa = sfio->pa;
|
||||
int nios;
|
||||
int grabbed, nios;
|
||||
|
||||
nios = 0;
|
||||
flags = (flags & SF_NODISKIO) ? VM_ALLOC_NOWAIT : 0;
|
||||
@ -319,14 +319,14 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, off_t off, off_t len,
|
||||
* only required pages. Readahead pages are dealt with later.
|
||||
*/
|
||||
VM_OBJECT_WLOCK(obj);
|
||||
for (int i = 0; i < npages; i++) {
|
||||
pa[i] = vm_page_grab(obj, OFF_TO_IDX(vmoff(i, off)),
|
||||
VM_ALLOC_WIRED | VM_ALLOC_NORMAL | flags);
|
||||
if (pa[i] == NULL) {
|
||||
npages = i;
|
||||
rhpages = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
grabbed = vm_page_grab_pages(obj, OFF_TO_IDX(off),
|
||||
VM_ALLOC_NORMAL | VM_ALLOC_WIRED | flags, pa, npages);
|
||||
if (grabbed < npages) {
|
||||
for (int i = grabbed; i < npages; i++)
|
||||
pa[i] = NULL;
|
||||
npages = grabbed;
|
||||
rhpages = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < npages;) {
|
||||
|
Loading…
Reference in New Issue
Block a user