From owner-svn-src-stable-11@freebsd.org Thu Jun 22 11:03:43 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B172ED897A9; Thu, 22 Jun 2017 11:03:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8ABF27708E; Thu, 22 Jun 2017 11:03:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5MB3g74078265; Thu, 22 Jun 2017 11:03:42 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5MB3g2T078264; Thu, 22 Jun 2017 11:03:42 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201706221103.v5MB3g2T078264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 22 Jun 2017 11:03:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320231 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jun 2017 11:03:43 -0000 Author: kib Date: Thu Jun 22 11:03:42 2017 New Revision: 320231 URL: https://svnweb.freebsd.org/changeset/base/320231 Log: MFC r319975: Some minor improvements to vnode_pager_generic_putpages(). Approved by: re (marius) Modified: stable/11/sys/vm/vnode_pager.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vnode_pager.c ============================================================================== --- stable/11/sys/vm/vnode_pager.c Thu Jun 22 07:57:29 2017 (r320230) +++ stable/11/sys/vm/vnode_pager.c Thu Jun 22 11:03:42 2017 (r320231) @@ -1158,7 +1158,7 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page 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 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 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 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 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 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