Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 May 2016 11:42:41 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        fs@freebsd.org
Subject:   Re: fix for per-mount i/o counting in ffs
Message-ID:  <20160517084241.GY89104@kib.kiev.ua>
In-Reply-To: <20160517072104.I2137@besplex.bde.org>
References:  <20160517072104.I2137@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, May 17, 2016 at 07:26:08AM +1000, Bruce Evans wrote:
> Counting of i/o's in g_vfs_strategy() requires the fs to initialize
> devvp->v_rdev->si_mountpt to non-null.  This seems to be done correctly
> in ext2fs and msdosfs, but in ffs it is not done for ro mounts, or for
> rw mounts that started as ro.  The bug is most obvious for the root
> file system since it always starts as ro.

I committed the comments updates.

For the accounting patch, don't we want to account for all io, including
the mount-time metadata reads and initial superblock update ?

diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 9776554..712fc21 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -780,6 +780,8 @@ ffs_mountfs(devvp, mp, td)
 		mp->mnt_iosize_max = MAXPHYS;
 
 	devvp->v_bufobj.bo_ops = &ffs_ops;
+	if (devvp->v_type == VCHR)
+		devvp->v_rdev->si_mountpt = mp;
 
 	fs = NULL;
 	sblockloc = 0;
@@ -1049,8 +1051,6 @@ ffs_mountfs(devvp, mp, td)
 			ffs_flushfiles(mp, FORCECLOSE, td);
 			goto out;
 		}
-		if (devvp->v_type == VCHR && devvp->v_rdev != NULL)
-			devvp->v_rdev->si_mountpt = mp;
 		if (fs->fs_snapinum[0] != 0)
 			ffs_snapshot_mount(mp);
 		fs->fs_fmod = 1;
@@ -1083,6 +1083,8 @@ ffs_mountfs(devvp, mp, td)
 out:
 	if (bp)
 		brelse(bp);
+	if (devvp->v_type == VCHR && devvp->v_rdev != NULL)
+		devvp->v_rdev->si_mountpt = NULL;
 	if (cp != NULL) {
 		DROP_GIANT();
 		g_topology_lock();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160517084241.GY89104>