From owner-svn-src-all@freebsd.org Wed Apr 5 16:57:55 2017 Return-Path: Delivered-To: svn-src-all@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 4096FD30564; Wed, 5 Apr 2017 16:57:55 +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 013A4D51; Wed, 5 Apr 2017 16:57:54 +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 v35Gvse4064673; Wed, 5 Apr 2017 16:57:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v35GvrHW064671; Wed, 5 Apr 2017 16:57:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201704051657.v35GvrHW064671@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:57:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316528 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Apr 2017 16:57:55 -0000 Author: kib Date: Wed Apr 5 16:57:53 2017 New Revision: 316528 URL: https://svnweb.freebsd.org/changeset/base/316528 Log: Add V_VMIO flag for vinvalbuf(9) to indicate that the flush request was issued during VM-initiated i/o (pageout), so that the function does not try to flush or remove pages or wait for the vm object paging-in-progress counter. 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/kern/vfs_subr.c head/sys/sys/vnode.h Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Wed Apr 5 16:57:13 2017 (r316527) +++ head/sys/kern/vfs_subr.c Wed Apr 5 16:57:53 2017 (r316528) @@ -1673,13 +1673,15 @@ bufobj_invalbuf(struct bufobj *bo, int f */ do { bufobj_wwait(bo, 0, 0); - BO_UNLOCK(bo); - if (bo->bo_object != NULL) { - VM_OBJECT_WLOCK(bo->bo_object); - vm_object_pip_wait(bo->bo_object, "bovlbx"); - VM_OBJECT_WUNLOCK(bo->bo_object); + if ((flags & V_VMIO) == 0) { + BO_UNLOCK(bo); + if (bo->bo_object != NULL) { + VM_OBJECT_WLOCK(bo->bo_object); + vm_object_pip_wait(bo->bo_object, "bovlbx"); + VM_OBJECT_WUNLOCK(bo->bo_object); + } + BO_LOCK(bo); } - BO_LOCK(bo); } while (bo->bo_numoutput > 0); BO_UNLOCK(bo); @@ -1687,7 +1689,7 @@ bufobj_invalbuf(struct bufobj *bo, int f * Destroy the copy in the VM cache, too. */ if (bo->bo_object != NULL && - (flags & (V_ALT | V_NORMAL | V_CLEANONLY)) == 0) { + (flags & (V_ALT | V_NORMAL | V_CLEANONLY | V_VMIO)) == 0) { VM_OBJECT_WLOCK(bo->bo_object); vm_object_page_remove(bo->bo_object, 0, 0, (flags & V_SAVE) ? OBJPR_CLEANONLY : 0); @@ -1696,7 +1698,7 @@ bufobj_invalbuf(struct bufobj *bo, int f #ifdef INVARIANTS BO_LOCK(bo); - if ((flags & (V_ALT | V_NORMAL | V_CLEANONLY)) == 0 && + if ((flags & (V_ALT | V_NORMAL | V_CLEANONLY | V_VMIO)) == 0 && (bo->bo_dirty.bv_cnt > 0 || bo->bo_clean.bv_cnt > 0)) panic("vinvalbuf: flush failed"); BO_UNLOCK(bo); Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Wed Apr 5 16:57:13 2017 (r316527) +++ head/sys/sys/vnode.h Wed Apr 5 16:57:53 2017 (r316528) @@ -402,6 +402,7 @@ extern int vttoif_tab[]; #define V_ALT 0x0002 /* vinvalbuf: invalidate only alternate bufs */ #define V_NORMAL 0x0004 /* vinvalbuf: invalidate only regular bufs */ #define V_CLEANONLY 0x0008 /* vinvalbuf: invalidate only clean bufs */ +#define V_VMIO 0x0010 /* vinvalbuf: called during pageout */ #define REVOKEALL 0x0001 /* vop_revoke: revoke all aliases */ #define V_WAIT 0x0001 /* vn_start_write: sleep for suspend */ #define V_NOWAIT 0x0002 /* vn_start_write: don't sleep for suspend */