From owner-svn-src-all@FreeBSD.ORG Sun Apr 8 06:20:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 164DC106566B; Sun, 8 Apr 2012 06:20:22 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 021D58FC0C; Sun, 8 Apr 2012 06:20:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q386KLPW096982; Sun, 8 Apr 2012 06:20:21 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q386KL2E096980; Sun, 8 Apr 2012 06:20:21 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201204080620.q386KL2E096980@svn.freebsd.org> From: Kirk McKusick Date: Sun, 8 Apr 2012 06:20:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r234026 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 08 Apr 2012 06:20:22 -0000 Author: mckusick Date: Sun Apr 8 06:20:21 2012 New Revision: 234026 URL: http://svn.freebsd.org/changeset/base/234026 Log: Expand locking around identification of filesystem mount point when accounting for I/O counts at completion of I/O operation. Also switch from using global devmtx to vnode mutex to reduce contention. Suggested and reviewed by: kib Modified: head/sys/geom/geom_vfs.c Modified: head/sys/geom/geom_vfs.c ============================================================================== --- head/sys/geom/geom_vfs.c Sun Apr 8 06:18:18 2012 (r234025) +++ head/sys/geom/geom_vfs.c Sun Apr 8 06:20:21 2012 (r234026) @@ -97,6 +97,7 @@ g_vfs_done(struct bio *bip) int vfslocked, destroy; struct mount *mp; struct vnode *vp; + struct cdev *cdevp; /* * Collect statistics on synchronous and asynchronous read @@ -106,12 +107,23 @@ g_vfs_done(struct bio *bip) */ bp = bip->bio_caller2; vp = bp->b_vp; - if (vp == NULL) + if (vp == NULL) { mp = NULL; - else if (vn_isdisk(vp, NULL)) - mp = vp->v_rdev->si_mountpt; - else - mp = vp->v_mount; + } else { + /* + * If not a disk vnode, use its associated mount point + * otherwise use the mountpoint associated with the disk. + */ + VI_LOCK(vp); + if (vp->v_type != VCHR || + (cdevp = vp->v_rdev) == NULL || + cdevp->si_devsw == NULL || + (cdevp->si_devsw->d_flags & D_DISK) == 0) + mp = vp->v_mount; + else + mp = cdevp->si_mountpt; + VI_UNLOCK(vp); + } if (mp != NULL) { if (bp->b_iocmd == BIO_WRITE) { if (LK_HOLDER(bp->b_lock.lk_lock) == LK_KERNPROC)