From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from userp2130.oracle.com ([156.151.31.86]:39884 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726073AbfDKPdn (ORCPT ); Thu, 11 Apr 2019 11:33:43 -0400 Date: Thu, 11 Apr 2019 08:33:30 -0700 From: "Darrick J. Wong" Subject: Re: [PATCH 7/8] xfs: report AG health via AG geometry ioctl Message-ID: <20190411153330.GF1019523@magnolia> References: <155494712442.1090518.2784809287026447547.stgit@magnolia> <155494717070.1090518.15401214807663806671.stgit@magnolia> <20190411130957.GG2888@bfoster> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190411130957.GG2888@bfoster> Sender: linux-xfs-owner@vger.kernel.org List-ID: List-Id: xfs To: Brian Foster Cc: linux-xfs@vger.kernel.org On Thu, Apr 11, 2019 at 09:09:57AM -0400, Brian Foster wrote: > On Wed, Apr 10, 2019 at 06:46:10PM -0700, Darrick J. Wong wrote: > > From: Darrick J. Wong > > > > Use the AG geometry info ioctl to report health status too. > > > > Signed-off-by: Darrick J. Wong > > --- > > fs/xfs/libxfs/xfs_fs.h | 14 +++++++++++++- > > fs/xfs/libxfs/xfs_health.h | 2 ++ > > fs/xfs/xfs_health.c | 43 +++++++++++++++++++++++++++++++++++++++++++ > > fs/xfs/xfs_ioctl.c | 2 ++ > > 4 files changed, 60 insertions(+), 1 deletion(-) > > > > > ... > > diff --git a/fs/xfs/xfs_health.c b/fs/xfs/xfs_health.c > > index eb8dbc3a952a..0315b95a8d84 100644 > > --- a/fs/xfs/xfs_health.c > > +++ b/fs/xfs/xfs_health.c > > @@ -321,3 +321,46 @@ xfs_fsop_geom_health( > ... > > +/* Fill out ag geometry health info. */ > > +void > > +xfs_ag_geom_health( > > + struct xfs_mount *mp, > > + xfs_agnumber_t agno, > > + struct xfs_ag_geometry *ageo) > > +{ > > + struct xfs_perag *pag; > > + const struct ioctl_sick_map *m; > > + unsigned int sick; > > + unsigned int checked; > > + > > + ASSERT(agno < mp->m_sb.sb_agcount); > > + > > + ageo->ag_sick = 0; > > + ageo->ag_checked = 0; > > + > > + pag = xfs_perag_get(mp, agno); > > + xfs_ag_measure_sickness(pag, &sick, &checked); > > + for (m = ag_map; m->sick_mask; m++) { > > + if (checked & m->sick_mask) > > + ageo->ag_checked |= m->ioctl_mask; > > + if (sick & m->sick_mask) > > + ageo->ag_sick |= m->ioctl_mask; > > + } > > FWIW this is pretty much what I was asking for in the mapping helper in > the previous patch. I didn't realize this was going to be reused for > another ioctl/struct, however, so disregard my previous comment about > renaming ->ioctl_mask. ;) > > > + > > + xfs_perag_put(pag); > > +} > > diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c > > index 3e3ee197bd0f..c47f4201452c 100644 > > --- a/fs/xfs/xfs_ioctl.c > > +++ b/fs/xfs/xfs_ioctl.c > > @@ -822,6 +822,8 @@ xfs_ioc_ag_geometry( > > if (error) > > return error; > > > > + xfs_ag_geom_health(mp, ageo.ag_number, &ageo); > > + > > Any reason not to push this down into the get_geom() helper since it's > part of the initial version of the ag geometry structure and we already > have the xfs_perag there? No particularly strong reason not to. Will fix. Thanks for reviewing all this stuff! --D > Brian > > > if (copy_to_user(arg, &ageo, sizeof(ageo))) > > return -EFAULT; > > return 0; > >