Make uvn_findpages to return number of pages found so that caller can
easily check if all requested pages are found or not.
This commit is contained in:
parent
36efaa3565
commit
2afb4efc4c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uvm_extern.h,v 1.70 2001/12/10 01:52:26 thorpej Exp $ */
|
||||
/* $NetBSD: uvm_extern.h,v 1.71 2002/05/17 22:00:50 enami Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -681,7 +681,7 @@ void uvm_deallocate __P((struct vm_map *, vaddr_t, vsize_t));
|
||||
void uvm_vnp_setsize __P((struct vnode *, voff_t));
|
||||
void uvm_vnp_sync __P((struct mount *));
|
||||
struct uvm_object *uvn_attach __P((void *, vm_prot_t));
|
||||
void uvn_findpages __P((struct uvm_object *, voff_t,
|
||||
int uvn_findpages __P((struct uvm_object *, voff_t,
|
||||
int *, struct vm_page **, int));
|
||||
void uvm_vnp_zerorange __P((struct vnode *, off_t, size_t));
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uvm_vnode.c,v 1.57 2001/12/31 07:00:15 chs Exp $ */
|
||||
/* $NetBSD: uvm_vnode.c,v 1.58 2002/05/17 22:00:50 enami Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Charles D. Cranor and Washington University.
|
||||
@ -50,7 +50,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.57 2001/12/31 07:00:15 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.58 2002/05/17 22:00:50 enami Exp $");
|
||||
|
||||
#include "fs_nfs.h"
|
||||
#include "opt_uvmhist.h"
|
||||
@ -311,7 +311,7 @@ uvn_get(uobj, offset, pps, npagesp, centeridx, access_type, advice, flags)
|
||||
* => returned pages will be BUSY.
|
||||
*/
|
||||
|
||||
void
|
||||
int
|
||||
uvn_findpages(uobj, offset, npagesp, pgs, flags)
|
||||
struct uvm_object *uobj;
|
||||
voff_t offset;
|
||||
@ -319,28 +319,33 @@ uvn_findpages(uobj, offset, npagesp, pgs, flags)
|
||||
struct vm_page **pgs;
|
||||
int flags;
|
||||
{
|
||||
int i, count, npages, rv;
|
||||
int i, count, found, npages, rv;
|
||||
|
||||
count = 0;
|
||||
count = found = 0;
|
||||
npages = *npagesp;
|
||||
if (flags & UFP_BACKWARD) {
|
||||
for (i = npages - 1; i >= 0; i--, offset -= PAGE_SIZE) {
|
||||
rv = uvn_findpage(uobj, offset, &pgs[i], flags);
|
||||
if (flags & UFP_DIRTYONLY && rv == 0) {
|
||||
break;
|
||||
}
|
||||
if (rv == 0) {
|
||||
if (flags & UFP_DIRTYONLY)
|
||||
break;
|
||||
} else
|
||||
found++;
|
||||
count++;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < npages; i++, offset += PAGE_SIZE) {
|
||||
rv = uvn_findpage(uobj, offset, &pgs[i], flags);
|
||||
if (flags & UFP_DIRTYONLY && rv == 0) {
|
||||
break;
|
||||
}
|
||||
if (rv == 0) {
|
||||
if (flags & UFP_DIRTYONLY)
|
||||
break;
|
||||
} else
|
||||
found++;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
*npagesp = count;
|
||||
return (found);
|
||||
}
|
||||
|
||||
int
|
||||
@ -399,6 +404,7 @@ uvn_findpage(uobj, offset, pgp, flags)
|
||||
return 0;
|
||||
}
|
||||
pg->flags |= PG_WANTED;
|
||||
UVMHIST_LOG(ubchist, "wait %p", pg,0,0,0);
|
||||
UVM_UNLOCK_AND_WAIT(pg, &uobj->vmobjlock, 0,
|
||||
"uvn_fp2", 0);
|
||||
simple_lock(&uobj->vmobjlock);
|
||||
@ -417,6 +423,7 @@ uvn_findpage(uobj, offset, pgp, flags)
|
||||
(pg->flags & PG_CLEAN) == 0;
|
||||
pg->flags |= PG_CLEAN;
|
||||
if (!dirty) {
|
||||
UVMHIST_LOG(ubchist, "dirtonly", 0,0,0,0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user