From owner-svn-src-head@FreeBSD.ORG Sat Sep 13 18:26:14 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 280CC541; Sat, 13 Sep 2014 18:26:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 07EA494C; Sat, 13 Sep 2014 18:26:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8DIQDfL068266; Sat, 13 Sep 2014 18:26:13 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8DIQDD6068262; Sat, 13 Sep 2014 18:26:13 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201409131826.s8DIQDD6068262@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 13 Sep 2014 18:26:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271540 - in head/sys: fs/ext2fs ufs/ffs 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.18-1 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: Sat, 13 Sep 2014 18:26:14 -0000 Author: alc Date: Sat Sep 13 18:26:13 2014 New Revision: 271540 URL: http://svnweb.freebsd.org/changeset/base/271540 Log: We don't need an exclusive object lock on the expected execution path through {ext2,ffs}_getpages(). Reviewed by: kib, pfg MFC after: 6 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/sys/fs/ext2fs/ext2_vnops.c head/sys/ufs/ffs/ffs_vnops.c Modified: head/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vnops.c Sat Sep 13 18:24:54 2014 (r271539) +++ head/sys/fs/ext2fs/ext2_vnops.c Sat Sep 13 18:26:13 2014 (r271540) @@ -2074,19 +2074,25 @@ ext2_getpages(struct vop_getpages_args * vm_page_t mreq; int pcount; - pcount = round_page(ap->a_count) / PAGE_SIZE; mreq = ap->a_m[ap->a_reqpage]; /* + * Since the caller has busied the requested page, that page's valid + * field will not be changed by other threads. + */ + vm_page_assert_xbusied(mreq); + + /* * if ANY DEV_BSIZE blocks are valid on a large filesystem block, * then the entire page is valid. Since the page may be mapped, * user programs might reference data beyond the actual end of file * occuring within the page. We have to zero that data. */ - VM_OBJECT_WLOCK(mreq->object); if (mreq->valid) { + VM_OBJECT_WLOCK(mreq->object); if (mreq->valid != VM_PAGE_BITS_ALL) vm_page_zero_invalid(mreq, TRUE); + pcount = round_page(ap->a_count) / PAGE_SIZE; for (i = 0; i < pcount; i++) { if (i != ap->a_reqpage) { vm_page_lock(ap->a_m[i]); @@ -2097,7 +2103,6 @@ ext2_getpages(struct vop_getpages_args * VM_OBJECT_WUNLOCK(mreq->object); return VM_PAGER_OK; } - VM_OBJECT_WUNLOCK(mreq->object); return vnode_pager_generic_getpages(ap->a_vp, ap->a_m, ap->a_count, Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Sat Sep 13 18:24:54 2014 (r271539) +++ head/sys/ufs/ffs/ffs_vnops.c Sat Sep 13 18:26:13 2014 (r271540) @@ -857,19 +857,25 @@ ffs_getpages(ap) vm_page_t mreq; int pcount; - pcount = round_page(ap->a_count) / PAGE_SIZE; mreq = ap->a_m[ap->a_reqpage]; /* + * Since the caller has busied the requested page, that page's valid + * field will not be changed by other threads. + */ + vm_page_assert_xbusied(mreq); + + /* * if ANY DEV_BSIZE blocks are valid on a large filesystem block, * then the entire page is valid. Since the page may be mapped, * user programs might reference data beyond the actual end of file * occuring within the page. We have to zero that data. */ - VM_OBJECT_WLOCK(mreq->object); if (mreq->valid) { + VM_OBJECT_WLOCK(mreq->object); if (mreq->valid != VM_PAGE_BITS_ALL) vm_page_zero_invalid(mreq, TRUE); + pcount = round_page(ap->a_count) / PAGE_SIZE; for (i = 0; i < pcount; i++) { if (i != ap->a_reqpage) { vm_page_lock(ap->a_m[i]); @@ -880,7 +886,6 @@ ffs_getpages(ap) VM_OBJECT_WUNLOCK(mreq->object); return VM_PAGER_OK; } - VM_OBJECT_WUNLOCK(mreq->object); return vnode_pager_generic_getpages(ap->a_vp, ap->a_m, ap->a_count,