summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2017-06-22 11:03:42 +0000
committerkib <kib@FreeBSD.org>2017-06-22 11:03:42 +0000
commitd57b0a7b7d93111f6b73ad259d8481935034be36 (patch)
tree31fca764eeee6708b1924ef9fad80b528329c891
parent2e9e56b7f675693e22583c9722306e049998c889 (diff)
downloadFreeBSD-src-d57b0a7b7d93111f6b73ad259d8481935034be36.zip
FreeBSD-src-d57b0a7b7d93111f6b73ad259d8481935034be36.tar.gz
MFC r319975:
Some minor improvements to vnode_pager_generic_putpages(). Approved by: re (marius)
-rw-r--r--sys/vm/vnode_pager.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c
index 3349101..efa72f38 100644
--- a/sys/vm/vnode_pager.c
+++ b/sys/vm/vnode_pager.c
@@ -1158,7 +1158,7 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page_t *ma, int bytecount,
vm_ooffset_t poffset;
struct uio auio;
struct iovec aiov;
- int count, error, i, maxsize, ncount, ppscheck;
+ int count, error, i, maxsize, ncount, pgoff, ppscheck;
static struct timeval lastfail;
static int curfail;
@@ -1169,10 +1169,11 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page_t *ma, int bytecount,
rtvals[i] = VM_PAGER_ERROR;
if ((int64_t)ma[0]->pindex < 0) {
- printf("vnode_pager_putpages: attempt to write meta-data!!! -- 0x%lx(%lx)\n",
- (long)ma[0]->pindex, (u_long)ma[0]->dirty);
+ printf("vnode_pager_generic_putpages: "
+ "attempt to write meta-data 0x%jx(%lx)\n",
+ (uintmax_t)ma[0]->pindex, (u_long)ma[0]->dirty);
rtvals[0] = VM_PAGER_BAD;
- return VM_PAGER_BAD;
+ return (VM_PAGER_BAD);
}
maxsize = count * PAGE_SIZE;
@@ -1195,8 +1196,6 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page_t *ma, int bytecount,
VM_OBJECT_WLOCK(object);
if (maxsize + poffset > object->un_pager.vnp.vnp_size) {
if (object->un_pager.vnp.vnp_size > poffset) {
- int pgoff;
-
maxsize = object->un_pager.vnp.vnp_size - poffset;
ncount = btoc(maxsize);
if ((pgoff = (int)maxsize & PAGE_MASK) != 0) {
@@ -1210,6 +1209,7 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page_t *ma, int bytecount,
vm_page_assert_sbusied(m);
KASSERT(!pmap_page_is_write_mapped(m),
("vnode_pager_generic_putpages: page %p is not read-only", m));
+ MPASS(m->dirty != 0);
vm_page_clear_dirty(m, pgoff, PAGE_SIZE -
pgoff);
}
@@ -1217,15 +1217,14 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page_t *ma, int bytecount,
maxsize = 0;
ncount = 0;
}
- if (ncount < count) {
- for (i = ncount; i < count; i++) {
- rtvals[i] = VM_PAGER_BAD;
- }
- }
+ for (i = ncount; i < count; i++)
+ rtvals[i] = VM_PAGER_BAD;
}
+ for (i = 0; i < ncount - ((btoc(maxsize) & PAGE_MASK) != 0); i++)
+ MPASS(ma[i]->dirty == VM_PAGE_BITS_ALL);
VM_OBJECT_WUNLOCK(object);
- aiov.iov_base = (caddr_t) 0;
+ aiov.iov_base = NULL;
aiov.iov_len = maxsize;
auio.uio_iov = &aiov;
auio.uio_iovcnt = 1;
@@ -1233,26 +1232,23 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page_t *ma, int bytecount,
auio.uio_segflg = UIO_NOCOPY;
auio.uio_rw = UIO_WRITE;
auio.uio_resid = maxsize;
- auio.uio_td = (struct thread *) 0;
+ auio.uio_td = NULL;
error = VOP_WRITE(vp, &auio, vnode_pager_putpages_ioflags(flags),
curthread->td_ucred);
PCPU_INC(cnt.v_vnodeout);
PCPU_ADD(cnt.v_vnodepgsout, ncount);
ppscheck = 0;
- if (error) {
- if ((ppscheck = ppsratecheck(&lastfail, &curfail, 1)))
- printf("vnode_pager_putpages: I/O error %d\n", error);
- }
- if (auio.uio_resid) {
- if (ppscheck || ppsratecheck(&lastfail, &curfail, 1))
- printf("vnode_pager_putpages: residual I/O %zd at %lu\n",
- auio.uio_resid, (u_long)ma[0]->pindex);
- }
- for (i = 0; i < ncount; i++) {
+ if (error != 0 && (ppscheck = ppsratecheck(&lastfail, &curfail, 1))
+ != 0)
+ printf("vnode_pager_putpages: I/O error %d\n", error);
+ if (auio.uio_resid != 0 && (ppscheck != 0 ||
+ ppsratecheck(&lastfail, &curfail, 1) != 0))
+ printf("vnode_pager_putpages: residual I/O %zd at %ju\n",
+ auio.uio_resid, (uintmax_t)ma[0]->pindex);
+ for (i = 0; i < ncount; i++)
rtvals[i] = VM_PAGER_OK;
- }
- return rtvals[0];
+ return (rtvals[0]);
}
int
OpenPOWER on IntegriCloud