version 1.53.2.13, 2012/02/17 08:18:57 |
version 1.53.2.14, 2012/05/23 10:08:14 |
Line 60 static void genfs_dio_iodone(struct buf |
|
Line 60 static void genfs_dio_iodone(struct buf |
|
|
|
static int genfs_do_io(struct vnode *, off_t, vaddr_t, size_t, int, enum uio_rw, |
static int genfs_do_io(struct vnode *, off_t, vaddr_t, size_t, int, enum uio_rw, |
void (*)(struct buf *)); |
void (*)(struct buf *)); |
static void genfs_rel_pages(struct vm_page **, int); |
static void genfs_rel_pages(struct vm_page **, unsigned int); |
static void genfs_markdirty(struct vnode *); |
static void genfs_markdirty(struct vnode *); |
|
|
int genfs_maxdio = MAXPHYS; |
int genfs_maxdio = MAXPHYS; |
|
|
static void |
static void |
genfs_rel_pages(struct vm_page **pgs, int npages) |
genfs_rel_pages(struct vm_page **pgs, unsigned int npages) |
{ |
{ |
int i; |
unsigned int i; |
|
|
for (i = 0; i < npages; i++) { |
for (i = 0; i < npages; i++) { |
struct vm_page *pg = pgs[i]; |
struct vm_page *pg = pgs[i]; |
|
|
if (pg == NULL || pg == PGO_DONTCARE) |
if (pg == NULL || pg == PGO_DONTCARE) |
continue; |
continue; |
|
KASSERT(uvm_page_locked_p(pg)); |
if (pg->flags & PG_FAKE) { |
if (pg->flags & PG_FAKE) { |
pg->flags |= PG_RELEASED; |
pg->flags |= PG_RELEASED; |
} |
} |
|
|
skipbytes = 0; |
skipbytes = 0; |
|
|
kva = uvm_pagermapin(pgs, npages, |
kva = uvm_pagermapin(pgs, npages, |
UVMPAGER_MAPIN_READ | UVMPAGER_MAPIN_WAITOK); |
UVMPAGER_MAPIN_READ | (async ? 0 : UVMPAGER_MAPIN_WAITOK)); |
|
if (kva == 0) { |
|
error = EBUSY; |
|
goto mapin_fail; |
|
} |
|
|
mbp = getiobuf(vp, true); |
mbp = getiobuf(vp, true); |
mbp->b_bufsize = totalbytes; |
mbp->b_bufsize = totalbytes; |
|
|
mutex_exit(uobj->vmobjlock); |
mutex_exit(uobj->vmobjlock); |
} |
} |
} |
} |
if (!glocked) { |
|
genfs_node_unlock(vp); |
|
} |
|
|
|
putiobuf(mbp); |
putiobuf(mbp); |
} |
} |
|
|
|
mapin_fail: |
|
if (!glocked) { |
|
genfs_node_unlock(vp); |
|
} |
mutex_enter(uobj->vmobjlock); |
mutex_enter(uobj->vmobjlock); |
|
|
/* |
/* |
|
|
*/ |
*/ |
|
|
if (error) { |
if (error) { |
for (i = 0; i < npages; i++) { |
genfs_rel_pages(pgs, npages); |
struct vm_page *pg = pgs[i]; |
|
|
|
if (pg == NULL) { |
|
continue; |
|
} |
|
UVMHIST_LOG(ubchist, "examining pg %p flags 0x%x", |
|
pg, pg->flags, 0,0); |
|
if (pg->flags & PG_FAKE) { |
|
pg->flags |= PG_RELEASED; |
|
} |
|
} |
|
mutex_enter(&uvm_pageqlock); |
|
uvm_page_unbusy(pgs, npages); |
|
mutex_exit(&uvm_pageqlock); |
|
mutex_exit(uobj->vmobjlock); |
mutex_exit(uobj->vmobjlock); |
UVMHIST_LOG(ubchist, "returning error %d", error,0,0,0); |
UVMHIST_LOG(ubchist, "returning error %d", error,0,0,0); |
goto out_err_free; |
goto out_err_free; |
Line 1381 genfs_do_io(struct vnode *vp, off_t off, |
|
Line 1373 genfs_do_io(struct vnode *vp, off_t off, |
|
size_t bytes, iobytes, skipbytes; |
size_t bytes, iobytes, skipbytes; |
struct buf *mbp, *bp; |
struct buf *mbp, *bp; |
const bool async = (flags & PGO_SYNCIO) == 0; |
const bool async = (flags & PGO_SYNCIO) == 0; |
|
const bool lazy = (flags & PGO_LAZY) == 0; |
const bool iowrite = rw == UIO_WRITE; |
const bool iowrite = rw == UIO_WRITE; |
const int brw = iowrite ? B_WRITE : B_READ; |
const int brw = iowrite ? B_WRITE : B_READ; |
UVMHIST_FUNC(__func__); UVMHIST_CALLED(ubchist); |
UVMHIST_FUNC(__func__); UVMHIST_CALLED(ubchist); |
Line 1424 genfs_do_io(struct vnode *vp, off_t off, |
|
Line 1417 genfs_do_io(struct vnode *vp, off_t off, |
|
} |
} |
if (curlwp == uvm.pagedaemon_lwp) |
if (curlwp == uvm.pagedaemon_lwp) |
BIO_SETPRIO(mbp, BPRIO_TIMELIMITED); |
BIO_SETPRIO(mbp, BPRIO_TIMELIMITED); |
else if (async) |
else if (async || lazy) |
BIO_SETPRIO(mbp, BPRIO_TIMENONCRITICAL); |
BIO_SETPRIO(mbp, BPRIO_TIMENONCRITICAL); |
else |
else |
BIO_SETPRIO(mbp, BPRIO_TIMECRITICAL); |
BIO_SETPRIO(mbp, BPRIO_TIMECRITICAL); |