Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys eliminate the VM_PAGER_* error codes in favor of the tra...
details: https://anonhg.NetBSD.org/src/rev/da7de6d7c54c
branches: trunk
changeset: 506998:da7de6d7c54c
user: chs <chs%NetBSD.org@localhost>
date: Sat Mar 10 22:46:45 2001 +0000
description:
eliminate the VM_PAGER_* error codes in favor of the traditional E* codes.
the mapping is:
VM_PAGER_OK 0
VM_PAGER_BAD <unused>
VM_PAGER_FAIL <unused>
VM_PAGER_PEND 0 (see below)
VM_PAGER_ERROR EIO
VM_PAGER_AGAIN EAGAIN
VM_PAGER_UNLOCK EBUSY
VM_PAGER_REFAULT ERESTART
for async i/o requests, it used to be possible for the request to
be convert to sync, and the pager would return VM_PAGER_OK or VM_PAGER_PEND
to indicate whether the caller should perform post-i/o cleanup.
this is no longer allowed; pagers must now return 0 to indicate that
the async i/o was successfully started, and the caller never needs to
worry about doing the post-i/o cleanup.
diffstat:
sys/miscfs/genfs/genfs_vnops.c | 10 +-
sys/nfs/nfs_bio.c | 8 +-
sys/uvm/uvm_anon.c | 12 +-
sys/uvm/uvm_aobj.c | 20 ++--
sys/uvm/uvm_bio.c | 10 +-
sys/uvm/uvm_device.c | 10 +-
sys/uvm/uvm_fault.c | 36 +++----
sys/uvm/uvm_loan.c | 22 ++--
sys/uvm/uvm_pager.c | 54 +++---------
sys/uvm/uvm_pager.h | 24 +-----
sys/uvm/uvm_pdaemon.c | 169 +++-------------------------------------
sys/uvm/uvm_swap.c | 24 +++--
sys/uvm/uvm_vnode.c | 60 ++++----------
13 files changed, 121 insertions(+), 338 deletions(-)
diffs (truncated from 1062 to 300 lines):
diff -r fc5be4266727 -r da7de6d7c54c sys/miscfs/genfs/genfs_vnops.c
--- a/sys/miscfs/genfs/genfs_vnops.c Sat Mar 10 22:37:54 2001 +0000
+++ b/sys/miscfs/genfs/genfs_vnops.c Sat Mar 10 22:46:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfs_vnops.c,v 1.31 2001/02/28 02:59:19 chs Exp $ */
+/* $NetBSD: genfs_vnops.c,v 1.32 2001/03/10 22:46:45 chs Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -785,9 +785,9 @@
}
if (async) {
- UVMHIST_LOG(ubchist, "returning PEND",0,0,0,0);
+ UVMHIST_LOG(ubchist, "returning 0 (async)",0,0,0,0);
lockmgr(&vp->v_glock, LK_RELEASE, NULL);
- return EINPROGRESS;
+ return 0;
}
if (bp != NULL) {
error = biowait(mbp);
@@ -1057,8 +1057,8 @@
splx(s);
}
if (async) {
- UVMHIST_LOG(ubchist, "returning PEND", 0,0,0,0);
- return EINPROGRESS;
+ UVMHIST_LOG(ubchist, "returning 0 (async)", 0,0,0,0);
+ return 0;
}
if (bp != NULL) {
UVMHIST_LOG(ubchist, "waiting for mbp %p", mbp,0,0,0);
diff -r fc5be4266727 -r da7de6d7c54c sys/nfs/nfs_bio.c
--- a/sys/nfs/nfs_bio.c Sat Mar 10 22:37:54 2001 +0000
+++ b/sys/nfs/nfs_bio.c Sat Mar 10 22:46:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_bio.c,v 1.63 2001/02/27 04:37:46 chs Exp $ */
+/* $NetBSD: nfs_bio.c,v 1.64 2001/03/10 22:46:47 chs Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -1249,8 +1249,8 @@
splx(s);
}
if (async) {
- UVMHIST_LOG(ubchist, "returning PEND",0,0,0,0);
- return EINPROGRESS;
+ UVMHIST_LOG(ubchist, "returning 0 (async)",0,0,0,0);
+ return 0;
}
if (bp != NULL) {
error = biowait(mbp);
@@ -1493,7 +1493,7 @@
splx(s);
}
if (async) {
- return EINPROGRESS;
+ return 0;
}
if (bp != NULL) {
error = biowait(mbp);
diff -r fc5be4266727 -r da7de6d7c54c sys/uvm/uvm_anon.c
--- a/sys/uvm/uvm_anon.c Sat Mar 10 22:37:54 2001 +0000
+++ b/sys/uvm/uvm_anon.c Sat Mar 10 22:46:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_anon.c,v 1.15 2001/02/18 21:19:08 chs Exp $ */
+/* $NetBSD: uvm_anon.c,v 1.16 2001/03/10 22:46:47 chs Exp $ */
/*
*
@@ -483,20 +483,20 @@
rv = uvmfault_anonget(NULL, NULL, anon);
/*
- * if rv == VM_PAGER_OK, anon is still locked, else anon
+ * if rv == 0, anon is still locked, else anon
* is unlocked
*/
switch (rv) {
- case VM_PAGER_OK:
+ case 0:
break;
- case VM_PAGER_ERROR:
- case VM_PAGER_REFAULT:
+ case EIO:
+ case ERESTART:
/*
* nothing more to do on errors.
- * VM_PAGER_REFAULT can only mean that the anon was freed,
+ * ERESTART can only mean that the anon was freed,
* so again there's nothing to do.
*/
diff -r fc5be4266727 -r da7de6d7c54c sys/uvm/uvm_aobj.c
--- a/sys/uvm/uvm_aobj.c Sat Mar 10 22:37:54 2001 +0000
+++ b/sys/uvm/uvm_aobj.c Sat Mar 10 22:46:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_aobj.c,v 1.39 2001/02/18 21:19:08 chs Exp $ */
+/* $NetBSD: uvm_aobj.c,v 1.40 2001/03/10 22:46:47 chs Exp $ */
/*
* Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and
@@ -938,7 +938,7 @@
*
* cases 1 and 2 can be handled with PGO_LOCKED, case 3 cannot.
* so, if the "center" page hits case 3 (or any page, with PGO_ALLPAGES),
- * then we will need to return VM_PAGER_UNLOCK.
+ * then we will need to return EBUSY.
*
* => prefer map unlocked (not required)
* => object must be locked! we will _unlock_ it before starting any I/O.
@@ -1043,10 +1043,10 @@
*npagesp = gotpages;
if (done)
/* bingo! */
- return(VM_PAGER_OK);
+ return(0);
else
/* EEK! Need to unlock and I/O */
- return(VM_PAGER_UNLOCK);
+ return(EBUSY);
}
/*
@@ -1180,7 +1180,7 @@
/*
* I/O done. check for errors.
*/
- if (rv != VM_PAGER_OK)
+ if (rv != 0)
{
UVMHIST_LOG(pdhist, "<- done (error=%d)",
rv,0,0,0);
@@ -1231,7 +1231,7 @@
simple_unlock(&uobj->vmobjlock);
UVMHIST_LOG(pdhist, "<- done (OK)",0,0,0,0);
- return(VM_PAGER_OK);
+ return(0);
}
/*
@@ -1491,14 +1491,14 @@
simple_lock(&aobj->u_obj.vmobjlock);
switch (rv) {
- case VM_PAGER_OK:
+ case 0:
break;
- case VM_PAGER_ERROR:
- case VM_PAGER_REFAULT:
+ case EIO:
+ case ERESTART:
/*
* nothing more to do on errors.
- * VM_PAGER_REFAULT can only mean that the anon was freed,
+ * ERESTART can only mean that the anon was freed,
* so again there's nothing to do.
*/
return FALSE;
diff -r fc5be4266727 -r da7de6d7c54c sys/uvm/uvm_bio.c
--- a/sys/uvm/uvm_bio.c Sat Mar 10 22:37:54 2001 +0000
+++ b/sys/uvm/uvm_bio.c Sat Mar 10 22:46:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_bio.c,v 1.7 2001/02/02 01:55:52 enami Exp $ */
+/* $NetBSD: uvm_bio.c,v 1.8 2001/03/10 22:46:48 chs Exp $ */
/*
* Copyright (c) 1998 Chuck Silvers.
@@ -219,7 +219,7 @@
*/
if (flags & PGO_LOCKED) {
#if 0
- return VM_PAGER_UNLOCK;
+ return EBUSY;
#else
uvmfault_unlockall(ufi, NULL, &ubc_object.uobj, NULL);
flags &= ~PGO_LOCKED;
@@ -289,10 +289,10 @@
goto again;
}
if (error) {
- return VM_PAGER_ERROR;
+ return EIO;
}
if (npages == 0) {
- return VM_PAGER_OK;
+ return 0;
}
va = ufi->orig_rvaddr;
@@ -330,7 +330,7 @@
UVM_PAGE_OWN(pg, NULL);
}
simple_unlock(&uobj->vmobjlock);
- return VM_PAGER_OK;
+ return 0;
}
/*
diff -r fc5be4266727 -r da7de6d7c54c sys/uvm/uvm_device.c
--- a/sys/uvm/uvm_device.c Sat Mar 10 22:37:54 2001 +0000
+++ b/sys/uvm/uvm_device.c Sat Mar 10 22:46:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_device.c,v 1.30 2000/11/25 06:27:59 chs Exp $ */
+/* $NetBSD: uvm_device.c,v 1.31 2001/03/10 22:46:48 chs Exp $ */
/*
*
@@ -402,7 +402,7 @@
UVMHIST_LOG(maphist, "<- failed -- COW entry (etype=0x%x)",
entry->etype, 0,0,0);
uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj, NULL);
- return(VM_PAGER_ERROR);
+ return(EIO);
}
/*
@@ -428,7 +428,7 @@
* loop over the page range entering in as needed
*/
- retval = VM_PAGER_OK;
+ retval = 0;
for (lcv = 0 ; lcv < npages ; lcv++, curr_offset += PAGE_SIZE,
curr_va += PAGE_SIZE) {
if ((flags & PGO_ALLPAGES) == 0 && lcv != centeridx)
@@ -439,7 +439,7 @@
mdpgno = (*mapfn)(device, curr_offset, access_type);
if (mdpgno == -1) {
- retval = VM_PAGER_ERROR;
+ retval = EIO;
break;
}
paddr = pmap_phys_address(mdpgno);
@@ -462,7 +462,7 @@
uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap,
uobj, NULL);
uvm_wait("udv_fault");
- return (VM_PAGER_REFAULT);
+ return (ERESTART);
}
}
diff -r fc5be4266727 -r da7de6d7c54c sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c Sat Mar 10 22:37:54 2001 +0000
+++ b/sys/uvm/uvm_fault.c Sat Mar 10 22:46:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_fault.c,v 1.56 2001/02/18 21:19:08 chs Exp $ */
+/* $NetBSD: uvm_fault.c,v 1.57 2001/03/10 22:46:49 chs Exp $ */
/*
*
@@ -277,7 +277,7 @@
* page in that anon.
*
* => maps, amap, and anon locked by caller.
- * => if we fail (result != VM_PAGER_OK) we unlock everything.
+ * => if we fail (result != 0) we unlock everything.
* => if we are successful, we return with everything still locked.
* => we don't move the page on the queues [gets moved later]
* => if we allocate a new page [we_own], it gets put on the queues.
@@ -343,7 +343,7 @@
if ((pg->flags & (PG_BUSY|PG_RELEASED)) == 0) {
UVMHIST_LOG(maphist, "<- OK",0,0,0,0);
- return (VM_PAGER_OK);
+ return (0);
}
pg->flags |= PG_WANTED;
uvmexp.fltpgwait++;
@@ -456,12 +456,10 @@
NULL);
uvmexp.fltpgrele++;
UVMHIST_LOG(maphist, "<- REFAULT", 0,0,0,0);
- return (VM_PAGER_REFAULT); /* refault! */
+ return (ERESTART); /* refault! */
}
- if (result != VM_PAGER_OK) {
- KASSERT(result != VM_PAGER_PEND);
-
+ if (result != 0) {
/* remove page from anon */
anon->u.an_page = NULL;
@@ -489,7 +487,7 @@
else
simple_unlock(&anon->an_lock);
UVMHIST_LOG(maphist, "<- ERROR", 0,0,0,0);
- return (VM_PAGER_ERROR);
+ return (EIO);
}
/*
Home |
Main Index |
Thread Index |
Old Index