svn commit: r254890 - projects/camlock/sys/geom

Alexander Motin mav at FreeBSD.org
Sun Aug 25 22:18:06 UTC 2013


Author: mav
Date: Sun Aug 25 22:18:05 2013
New Revision: 254890
URL: http://svnweb.freebsd.org/changeset/base/254890

Log:
  Enable GEOM direct dispatch for GEOM VFS class, used for non-ZFS mounts.
  It is quite hard to measure difference with single device (even SSD), but
  it does not harm, so why not?

Modified:
  projects/camlock/sys/geom/geom_vfs.c

Modified: projects/camlock/sys/geom/geom_vfs.c
==============================================================================
--- projects/camlock/sys/geom/geom_vfs.c	Sun Aug 25 21:54:41 2013	(r254889)
+++ projects/camlock/sys/geom/geom_vfs.c	Sun Aug 25 22:18:05 2013	(r254890)
@@ -102,14 +102,10 @@ g_vfs_done(struct bio *bip)
 	/*
 	 * Collect statistics on synchronous and asynchronous read
 	 * and write counts for disks that have associated filesystems.
-	 * Since this run by the g_up thread it is single threaded and
-	 * we do not need to use atomic increments on the counters.
 	 */
 	bp = bip->bio_caller2;
 	vp = bp->b_vp;
-	if (vp == NULL) {
-		mp = NULL;
-	} else {
+	if (vp != NULL) {
 		/*
 		 * If not a disk vnode, use its associated mount point
 		 * otherwise use the mountpoint associated with the disk.
@@ -122,20 +118,20 @@ g_vfs_done(struct bio *bip)
 			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)
-				mp->mnt_stat.f_asyncwrites++;
-			else
-				mp->mnt_stat.f_syncwrites++;
-		} else {
-			if (LK_HOLDER(bp->b_lock.lk_lock) == LK_KERNPROC)
-				mp->mnt_stat.f_asyncreads++;
-			else
-				mp->mnt_stat.f_syncreads++;
+		if (mp != NULL) {
+			if (bp->b_iocmd == BIO_READ) {
+				if (LK_HOLDER(bp->b_lock.lk_lock) == LK_KERNPROC)
+					mp->mnt_stat.f_asyncreads++;
+				else
+					mp->mnt_stat.f_syncreads++;
+			} else if (bp->b_iocmd == BIO_WRITE) {
+				if (LK_HOLDER(bp->b_lock.lk_lock) == LK_KERNPROC)
+					mp->mnt_stat.f_asyncwrites++;
+				else
+					mp->mnt_stat.f_syncwrites++;
+			}
 		}
+		VI_UNLOCK(vp);
 	}
 
 	cp = bip->bio_from;
@@ -260,6 +256,7 @@ g_vfs_open(struct vnode *vp, struct g_co
 	vnode_create_vobject(vp, pp->mediasize, curthread);
 	*cpp = cp;
 	cp->private = vp;
+	cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
 	bo->bo_ops = g_vfs_bufops;
 	bo->bo_private = cp;
 	bo->bo_bsize = pp->sectorsize;


More information about the svn-src-projects mailing list