From owner-svn-src-head@freebsd.org Wed Apr 5 16:56:05 2017 Return-Path: Delivered-To: svn-src-head@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 8D2BBD3042C; Wed, 5 Apr 2017 16:56:05 +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 6A419A3A; Wed, 5 Apr 2017 16:56:05 +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 v35Gu4jI064524; Wed, 5 Apr 2017 16:56:04 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v35Gu4Pe064521; Wed, 5 Apr 2017 16:56:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201704051656.v35Gu4Pe064521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 5 Apr 2017 16:56:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316526 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Apr 2017 16:56:05 -0000 Author: kib Date: Wed Apr 5 16:56:04 2017 New Revision: 316526 URL: https://svnweb.freebsd.org/changeset/base/316526 Log: Extract calculation of ioflags from the vm_pager_putpages flags into a helper. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week X-Differential revision: https://reviews.freebsd.org/D10241 Modified: head/sys/vm/vnode_pager.c head/sys/vm/vnode_pager.h Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Wed Apr 5 16:45:00 2017 (r316525) +++ head/sys/vm/vnode_pager.c Wed Apr 5 16:56:04 2017 (r316526) @@ -1198,7 +1198,7 @@ vnode_pager_generic_putpages(struct vnod vm_ooffset_t poffset; struct uio auio; struct iovec aiov; - int count, error, i, ioflags, maxsize, ncount, ppscheck; + int count, error, i, maxsize, ncount, ppscheck; static struct timeval lastfail; static int curfail; @@ -1265,22 +1265,6 @@ vnode_pager_generic_putpages(struct vnod } VM_OBJECT_WUNLOCK(object); - /* - * pageouts are already clustered, use IO_ASYNC to force a bawrite() - * rather then a bdwrite() to prevent paging I/O from saturating - * the buffer cache. Dummy-up the sequential heuristic to cause - * large ranges to cluster. If neither IO_SYNC or IO_ASYNC is set, - * the system decides how to cluster. - */ - ioflags = IO_VMIO; - if (flags & (VM_PAGER_PUT_SYNC | VM_PAGER_PUT_INVAL)) - ioflags |= IO_SYNC; - else if ((flags & VM_PAGER_CLUSTER_OK) == 0) - ioflags |= IO_ASYNC; - ioflags |= (flags & VM_PAGER_PUT_INVAL) ? IO_INVAL: 0; - ioflags |= (flags & VM_PAGER_PUT_NOREUSE) ? IO_NOREUSE : 0; - ioflags |= IO_SEQMAX << IO_SEQSHIFT; - aiov.iov_base = (caddr_t) 0; aiov.iov_len = maxsize; auio.uio_iov = &aiov; @@ -1290,7 +1274,8 @@ vnode_pager_generic_putpages(struct vnod auio.uio_rw = UIO_WRITE; auio.uio_resid = maxsize; auio.uio_td = (struct thread *) 0; - error = VOP_WRITE(vp, &auio, ioflags, curthread->td_ucred); + error = VOP_WRITE(vp, &auio, vnode_pager_putpages_ioflags(flags), + curthread->td_ucred); PCPU_INC(cnt.v_vnodeout); PCPU_ADD(cnt.v_vnodepgsout, ncount); @@ -1310,6 +1295,30 @@ vnode_pager_generic_putpages(struct vnod return rtvals[0]; } +int +vnode_pager_putpages_ioflags(int pager_flags) +{ + int ioflags; + + /* + * Pageouts are already clustered, use IO_ASYNC to force a + * bawrite() rather then a bdwrite() to prevent paging I/O + * from saturating the buffer cache. Dummy-up the sequential + * heuristic to cause large ranges to cluster. If neither + * IO_SYNC or IO_ASYNC is set, the system decides how to + * cluster. + */ + ioflags = IO_VMIO; + if ((pager_flags & (VM_PAGER_PUT_SYNC | VM_PAGER_PUT_INVAL)) != 0) + ioflags |= IO_SYNC; + else if ((pager_flags & VM_PAGER_CLUSTER_OK) == 0) + ioflags |= IO_ASYNC; + ioflags |= (pager_flags & VM_PAGER_PUT_INVAL) != 0 ? IO_INVAL: 0; + ioflags |= (pager_flags & VM_PAGER_PUT_NOREUSE) != 0 ? IO_NOREUSE : 0; + ioflags |= IO_SEQMAX << IO_SEQSHIFT; + return (ioflags); +} + void vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written) { Modified: head/sys/vm/vnode_pager.h ============================================================================== --- head/sys/vm/vnode_pager.h Wed Apr 5 16:45:00 2017 (r316525) +++ head/sys/vm/vnode_pager.h Wed Apr 5 16:56:04 2017 (r316526) @@ -47,7 +47,7 @@ int vnode_pager_generic_putpages(struct int count, int flags, int *rtvals); int vnode_pager_local_getpages(struct vop_getpages_args *ap); int vnode_pager_local_getpages_async(struct vop_getpages_async_args *ap); - +int vnode_pager_putpages_ioflags(int pager_flags); void vnode_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); void vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written);