From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:56608 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726106AbfDKNJM (ORCPT ); Thu, 11 Apr 2019 09:09:12 -0400 Date: Thu, 11 Apr 2019 09:09:10 -0400 From: Brian Foster Subject: Re: [PATCH 6/8] xfs: report fs and rt health via geometry structure Message-ID: <20190411130910.GF2888@bfoster> References: <155494712442.1090518.2784809287026447547.stgit@magnolia> <155494716446.1090518.6511378096384851735.stgit@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <155494716446.1090518.6511378096384851735.stgit@magnolia> Sender: linux-xfs-owner@vger.kernel.org List-ID: List-Id: xfs To: "Darrick J. Wong" Cc: linux-xfs@vger.kernel.org On Wed, Apr 10, 2019 at 06:46:04PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong > > Use our newly expanded geometry structure to report the overall fs and > realtime health status. > > Signed-off-by: Darrick J. Wong > --- > fs/xfs/libxfs/xfs_fs.h | 11 ++++++++ > fs/xfs/libxfs/xfs_health.h | 3 ++ > fs/xfs/xfs_health.c | 57 ++++++++++++++++++++++++++++++++++++++++++++ > fs/xfs/xfs_ioctl.c | 2 ++ > 4 files changed, 72 insertions(+), 1 deletion(-) > > ... > diff --git a/fs/xfs/xfs_health.c b/fs/xfs/xfs_health.c > index 21728228e08b..eb8dbc3a952a 100644 > --- a/fs/xfs/xfs_health.c > +++ b/fs/xfs/xfs_health.c > @@ -264,3 +264,60 @@ xfs_inode_measure_sickness( > *checked = ip->i_checked; > spin_unlock(&ip->i_flags_lock); > } ... > + > +static inline void > +xfgeo_health_tick( > + struct xfs_fsop_geom *geo, > + unsigned int sick, > + unsigned int checked, > + unsigned int sick_mask, > + unsigned int fsop_mask) > +{ Could we just pass the struct ioctl_sick_map to this helper? IMO, that makes the mapping logic a bit more explicit and also doesn't introduce an unnecessary field name change between ->ioctl_mask and fsop_mask. FWIW, I might also rename ->ioctl_mask to ->geom_mask since it's specific to that structure. > + if (checked & sick_mask) > + geo->checked |= fsop_mask; > + if (sick & sick_mask) > + geo->sick |= fsop_mask; > +} > + ... > diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c > index 0aaf4f88524d..3e3ee197bd0f 100644 > --- a/fs/xfs/xfs_ioctl.c > +++ b/fs/xfs/xfs_ioctl.c ... > @@ -792,6 +793,7 @@ xfs_ioc_fsgeometry( > error = xfs_fs_geometry(&mp->m_sb, &fsgeo, struct_version); > if (error) > return error; > + xfs_fsop_geom_health(mp, &fsgeo); > Not really a problem, but it might make sense to not bother with this unless struct_version >= 5 (via the already existing check below). Brian > if (struct_version <= 3) > len = sizeof(struct xfs_fsop_geom_v1); >