From owner-freebsd-fs@freebsd.org Tue May 17 21:30:31 2016 Return-Path: Delivered-To: freebsd-fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82A85B3F9D9 for ; Tue, 17 May 2016 21:30:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mailman.ysv.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 70B661C8C for ; Tue, 17 May 2016 21:30:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: by mailman.ysv.freebsd.org (Postfix) id 6C66FB3F9D7; Tue, 17 May 2016 21:30:31 +0000 (UTC) Delivered-To: fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C128B3F9D6 for ; Tue, 17 May 2016 21:30:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 37D5D1C8B for ; Tue, 17 May 2016 21:30:30 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id BA0F3429C03; Wed, 18 May 2016 07:30:28 +1000 (AEST) Date: Wed, 18 May 2016 07:30:25 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans cc: Konstantin Belousov , fs@freebsd.org Subject: Re: fix for per-mount i/o counting in ffs In-Reply-To: <20160518061040.D5948@besplex.bde.org> Message-ID: <20160518070252.F6121@besplex.bde.org> References: <20160517072104.I2137@besplex.bde.org> <20160517084241.GY89104@kib.kiev.ua> <20160518061040.D5948@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=EfU1O6SC c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=JdS-s63oAcdDXkgrDngA:9 a=CjuIK1q_8ugA:10 X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 May 2016 21:30:31 -0000 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