fix for per-mount i/o counting in ffs
Bruce Evans
brde at optusnet.com.au
Tue May 17 21:30:31 UTC 2016
On Wed, 18 May 2016, Bruce Evans wrote:
> On Tue, 17 May 2016, Konstantin Belousov wrote:
>> ...
>> 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();
>
> Yes, that looks better.
Further cleanups:
- the null pointer check is bogus since we already dereferenced
devvp->v_rdev. We also assigned devvp->v_rdev to the variable
dev but spelled out devvp->v_rdev in a couple of other places.
- the VCHR check is bogus since we only work for VCHR and have
already checked for VCHR in vn_isdisk().
Similarly in ffs_umount() except there is no dev variable there.
Similarly in msdosfs.
NOT similarly in ext2fs. I was looking at the wrong tree again.
Only 1 of my trees has the patch to do this in ext2fs. The patch
for ffs applies almost verbatim.
Bruce
More information about the freebsd-fs
mailing list