Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/uebayasi-xip]: src/sys/miscfs/genfs Call XIP getpages() from within the ...
details: https://anonhg.NetBSD.org/src/rev/c7e9287680f6
branches: uebayasi-xip
changeset: 751870:c7e9287680f6
user: uebayasi <uebayasi%NetBSD.org@localhost>
date: Fri Nov 19 04:46:24 2010 +0000
description:
Call XIP getpages() from within the generic one.
diffstat:
sys/miscfs/genfs/genfs_io.c | 80 ++++++++++++++++++++++++++++----------------
1 files changed, 50 insertions(+), 30 deletions(-)
diffs (164 lines):
diff -r 8cb386c1d6e0 -r c7e9287680f6 sys/miscfs/genfs/genfs_io.c
--- a/sys/miscfs/genfs/genfs_io.c Fri Nov 19 04:14:30 2010 +0000
+++ b/sys/miscfs/genfs/genfs_io.c Fri Nov 19 04:46:24 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfs_io.c,v 1.36.2.38 2010/11/19 04:14:30 uebayasi Exp $ */
+/* $NetBSD: genfs_io.c,v 1.36.2.39 2010/11/19 04:46:24 uebayasi Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.36.2.38 2010/11/19 04:14:30 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.36.2.39 2010/11/19 04:46:24 uebayasi Exp $");
#include "opt_xip.h"
@@ -59,7 +59,6 @@
#include <uvm/uvm.h>
#include <uvm/uvm_pager.h>
-static int genfs_do_getpages(void *);
#ifdef XIP
static int genfs_do_getpages_xip(void *);
static int genfs_do_getpages_xip1(struct vnode *, voff_t, struct vm_page **,
@@ -123,28 +122,6 @@
int
genfs_getpages(void *v)
{
-#ifdef XIP
- struct vop_getpages_args /* {
- struct vnode *a_vp;
- voff_t a_offset;
- struct vm_page **a_m;
- int *a_count;
- int a_centeridx;
- vm_prot_t a_access_type;
- int a_advice;
- int a_flags;
- } */ * const ap = v;
-
- if ((ap->a_vp->v_vflag & VV_XIP) != 0)
- return genfs_do_getpages_xip(v);
- else
-#endif
- return genfs_do_getpages(v);
-}
-
-static int
-genfs_do_getpages(void *v)
-{
struct vop_getpages_args /* {
struct vnode *a_vp;
voff_t a_offset;
@@ -243,9 +220,27 @@
*/
if (flags & PGO_LOCKED) {
+#if 0
+ genfs_do_getpages_locked();
+ } else {
+ genfs_do_getpages_unlocked();
+ }
+}
+
+int
+genfs_do_getpages_locked()
+{
+#endif
int nfound;
struct vm_page *pg;
+#if 1
+ if ((ap->a_vp->v_vflag & VV_XIP) != 0) {
+ *ap->a_count = 0;
+ return 0;
+ }
+#endif
+
KASSERT(!glocked);
npages = *ap->a_count;
#if defined(DEBUG)
@@ -286,6 +281,17 @@
goto out_err;
}
mutex_exit(&uobj->vmobjlock);
+#if 0
+}
+
+int
+genfs_do_getpages_unlocked()
+{
+#endif
+#if 1
+ if ((ap->a_vp->v_vflag & VV_XIP) != 0)
+ return genfs_do_getpages_xip(v);
+#endif
/*
* find the requested pages and make some simple checks.
* leave space in the page array for a whole block.
@@ -395,6 +401,18 @@
*/
if (overwrite) {
+#if 0
+ genfs_do_getpages_overwrite();
+ } else {
+ genfs_do_getpages_io();
+ }
+}
+
+int
+genfs_do_getpages_overwrite()
+{
+ {
+#endif
if (!glocked) {
genfs_node_unlock(vp);
}
@@ -408,7 +426,13 @@
npages += ridx;
goto out;
}
+#if 0
+}
+int
+genfs_do_getpages_io()
+{
+#endif
/*
* the page wasn't resident and we're not overwriting,
* so we're going to have to do some i/o.
@@ -873,13 +897,9 @@
ebkoff = ((offset + PAGE_SIZE * npages) + (fs_bsize - 1)) &
~(fs_bsize - 1);
-
UVMHIST_LOG(ubchist, "xip npages=%d sbkoff=%lx ebkoff=%lx",
npages, (long)sbkoff, (long)ebkoff, 0);
- KASSERT(mutex_owned(&uobj->vmobjlock));
- mutex_exit(&uobj->vmobjlock);
-
off = offset;
for (i = 0; i < npages; i++) {
daddr_t lbn, blkno;
@@ -1521,7 +1541,6 @@
else
eof = endoff;
-
while (off < eof) {
int npages, orignpages, error, i;
struct vm_page *pgs[maxpages], *pg;
@@ -1532,6 +1551,7 @@
orignpages = npages;
KASSERT(mutex_owned(&uobj->vmobjlock));
+ mutex_exit(&uobj->vmobjlock);
error = genfs_do_getpages_xip1(vp, off, pgs, &npages, 0,
VM_PROT_ALL, 0, 0);
KASSERT(error == 0);
Home |
Main Index |
Thread Index |
Old Index