summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_vnode.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-11-28 13:47:41 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-11-28 13:47:41 +0000
commit4c46afe9f467831fba921bfa77a12903c4c39c7d (patch)
treeb755c95bf93b8cb384f911d3f70b96063188d78a /sys/uvm/uvm_vnode.c
parent8a3355695ffa23bba7a2cb69d229a81ba3485bf9 (diff)
Sync in more uvm changes from NetBSD.
This time we're getting rid of KERN_* and VM_PAGER_* error codes and use errnos instead.
Diffstat (limited to 'sys/uvm/uvm_vnode.c')
-rw-r--r--sys/uvm/uvm_vnode.c62
1 files changed, 18 insertions, 44 deletions
diff --git a/sys/uvm/uvm_vnode.c b/sys/uvm/uvm_vnode.c
index 667cbc5b458..cef3499f281 100644
--- a/sys/uvm/uvm_vnode.c
+++ b/sys/uvm/uvm_vnode.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: uvm_vnode.c,v 1.25 2001/11/27 05:27:12 art Exp $ */
-/* $NetBSD: uvm_vnode.c,v 1.47 2001/03/09 01:02:13 chs Exp $ */
+/* $OpenBSD: uvm_vnode.c,v 1.26 2001/11/28 13:47:40 art Exp $ */
+/* $NetBSD: uvm_vnode.c,v 1.48 2001/03/10 22:46:51 chs Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -247,8 +247,6 @@ uvn_reference(uobj)
* remove a reference to a VM object.
*
* => caller must call with object unlocked and map locked.
- * => this starts the detach process, but doesn't have to finish it
- * (async i/o could still be pending).
*/
static void
uvn_detach(uobj)
@@ -300,7 +298,7 @@ uvn_releasepg(pg, nextpgp)
* there are two tailq's in the uvm. structure... one for pending async
* i/o and one for "done" async i/o. to do an async i/o one puts
* a buf on the "pending" list (protected by splbio()), starts the
- * i/o and returns VM_PAGER_PEND. when the i/o is done, we expect
+ * i/o and returns 0. when the i/o is done, we expect
* some sort of "i/o done" function to be called (at splbio(), interrupt
* time). this function should remove the buf from the pending list
* and place it on the "done" list and wakeup the daemon. the daemon
@@ -391,6 +389,7 @@ uvn_flush(uobj, start, stop, flags)
int s;
int npages, result, lcv;
boolean_t retval, need_iosync, by_list, needs_clean, all, wasclean;
+ boolean_t async = (flags & PGO_SYNCIO) == 0;
voff_t curoff;
u_short pp_version;
UVMHIST_FUNC("uvn_flush"); UVMHIST_CALLED(maphist);
@@ -522,7 +521,7 @@ uvn_flush(uobj, start, stop, flags)
if ((flags & PGO_CLEANIT) == 0 || (pp->flags & PG_BUSY) != 0) {
needs_clean = FALSE;
- if (flags & PGO_SYNCIO)
+ if (!async)
need_iosync = TRUE;
} else {
@@ -587,7 +586,6 @@ uvn_flush(uobj, start, stop, flags)
UVM_PAGE_OWN(pp, "uvn_flush");
pmap_page_protect(pp, VM_PROT_READ);
pp_version = pp->version;
-ReTry:
ppsp = pps;
npages = sizeof(pps) / sizeof(struct vm_page *);
@@ -609,34 +607,10 @@ ReTry:
uvm_lock_pageq();
/*
- * VM_PAGER_AGAIN: given the structure of this pager, this
- * can only happen when we are doing async I/O and can't
- * map the pages into kernel memory (pager_map) due to lack
- * of vm space. if this happens we drop back to sync I/O.
- */
-
- if (result == VM_PAGER_AGAIN) {
-
- /*
- * it is unlikely, but page could have been released
- * while we had the object lock dropped. we ignore
- * this now and retry the I/O. we will detect and
- * handle the released page after the syncio I/O
- * completes.
- */
-#ifdef DIAGNOSTIC
- if (flags & PGO_SYNCIO)
- panic("uvn_flush: PGO_SYNCIO return 'try again' error (impossible)");
-#endif
- flags |= PGO_SYNCIO;
- goto ReTry;
- }
-
- /*
- * the cleaning operation is now done. finish up. note that
- * on error (!OK, !PEND) uvm_pager_put drops the cluster for us.
- * if success (OK, PEND) then uvm_pager_put returns the cluster
- * to us in ppsp/npages.
+ * the cleaning operation is now done. finish up. note that
+ * on error uvm_pager_put drops the cluster for us.
+ * on success uvm_pager_put returns the cluster to us in
+ * ppsp/npages.
*/
/*
@@ -644,7 +618,7 @@ ReTry:
* we can move on to the next page.
*/
- if (result == VM_PAGER_PEND &&
+ if (result == 0 && async &&
(flags & (PGO_DEACTIVATE|PGO_FREE)) == 0) {
/*
@@ -701,17 +675,17 @@ ReTry:
* verify the page wasn't moved while obj was
* unlocked
*/
- if (result == VM_PAGER_PEND && ptmp->uobject != uobj)
+ if (result == 0 && async && ptmp->uobject != uobj)
continue;
/*
* unbusy the page if I/O is done. note that for
- * pending I/O it is possible that the I/O op
+ * async I/O it is possible that the I/O op
* finished before we relocked the object (in
* which case the page is no longer busy).
*/
- if (result != VM_PAGER_PEND) {
+ if (result != 0 || !async) {
if (ptmp->flags & PG_WANTED) {
/* still holding object lock */
wakeup(ptmp);
@@ -730,7 +704,7 @@ ReTry:
continue;
} else {
if ((flags & PGO_WEAK) == 0 &&
- !(result == VM_PAGER_ERROR &&
+ !(result == EIO &&
curproc == uvm.pagedaemon_proc)) {
ptmp->flags |=
(PG_CLEAN|PG_CLEANCHK);
@@ -753,12 +727,12 @@ ReTry:
uvm_pagedeactivate(ptmp);
}
} else if (flags & PGO_FREE) {
- if (result == VM_PAGER_PEND) {
+ if (result == 0 && async) {
if ((ptmp->flags & PG_BUSY) != 0)
/* signal for i/o done */
ptmp->flags |= PG_RELEASED;
} else {
- if (result != VM_PAGER_OK) {
+ if (result != 0) {
printf("uvn_flush: obj=%p, "
"offset=0x%llx. error %d\n",
pp->uobject,
@@ -852,7 +826,7 @@ uvn_put(uobj, pps, npages, flags)
int error;
error = VOP_PUTPAGES(vp, pps, npages, flags, NULL);
- return uvm_errno2vmerror(error);
+ return error;
}
@@ -884,7 +858,7 @@ uvn_get(uobj, offset, pps, npagesp, centeridx, access_type, advice, flags)
UVMHIST_LOG(ubchist, "vp %p off 0x%x", vp, (int)offset, 0,0);
error = VOP_GETPAGES(vp, offset, pps, npagesp, centeridx,
access_type, advice, flags);
- return uvm_errno2vmerror(error);
+ return error;
}