From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Brian Foster <bfoster@redhat.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 06/10] xfs: report fs and rt health via geometry structure
Date: Tue, 2 Apr 2019 16:34:35 -0700 [thread overview]
Message-ID: <20190402233435.GJ5147@magnolia> (raw)
In-Reply-To: <20190402182310.GF5147@magnolia>
On Tue, Apr 02, 2019 at 11:23:10AM -0700, Darrick J. Wong wrote:
> On Tue, Apr 02, 2019 at 01:35:04PM -0400, Brian Foster wrote:
> > On Mon, Apr 01, 2019 at 10:10:46AM -0700, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <darrick.wong@oracle.com>
> > >
> > > Use our newly expanded geometry structure to report the overall fs and
> > > realtime health status.
> > >
> > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > > ---
> >
> > I kind of wonder whether it's possible (or makes sense) to make the core
> > sickness bits exportable to userspace and thus avoid some of the
> > translation code, but that aside this looks fine to me:
>
> Not sure -- for now I went with having separate bits and mapping
> functions so that the internal implementation doesn't get fused to the
> userspace interface, but seeing as the defines are the same we really
> could just copy straight from the incore structure and have a bunch of
> BUILD_BUG_ON(internal bit == ioctl bit) until they diverge more.
(Heh, the fsgeometry health bits -- we mix the fs and realtime
reporting, which means that we still need the kinda ugly function...)
--D
>
> --D
>
> > Reviewed-by: Brian Foster <bfoster@redhat.com>
> >
> > > fs/xfs/libxfs/xfs_fs.h | 11 ++++++++++-
> > > fs/xfs/libxfs/xfs_health.h | 3 +++
> > > fs/xfs/xfs_health.c | 27 +++++++++++++++++++++++++++
> > > fs/xfs/xfs_ioctl.c | 3 +++
> > > 4 files changed, 43 insertions(+), 1 deletion(-)
> > >
> > >
> > > diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h
> > > index 87226e00e7bd..ddbfde7ff79d 100644
> > > --- a/fs/xfs/libxfs/xfs_fs.h
> > > +++ b/fs/xfs/libxfs/xfs_fs.h
> > > @@ -199,9 +199,18 @@ typedef struct xfs_fsop_geom {
> > > __u32 rtsectsize; /* realtime sector size, bytes */
> > > __u32 dirblocksize; /* directory block size, bytes */
> > > __u32 logsunit; /* log stripe unit, bytes */
> > > - __u64 reserved[18]; /* reserved space */
> > > + __u32 health; /* o: unhealthy fs & rt metadata */
> > > + __u32 reserved32; /* reserved space */
> > > + __u64 reserved[17]; /* reserved space */
> > > } xfs_fsop_geom_t;
> > >
> > > +#define XFS_FSOP_GEOM_HEALTH_FS_COUNTERS (1 << 0) /* summary counters */
> > > +#define XFS_FSOP_GEOM_HEALTH_FS_UQUOTA (1 << 1) /* user quota */
> > > +#define XFS_FSOP_GEOM_HEALTH_FS_GQUOTA (1 << 2) /* group quota */
> > > +#define XFS_FSOP_GEOM_HEALTH_FS_PQUOTA (1 << 3) /* project quota */
> > > +#define XFS_FSOP_GEOM_HEALTH_RT_BITMAP (1 << 4) /* realtime bitmap */
> > > +#define XFS_FSOP_GEOM_HEALTH_RT_SUMMARY (1 << 5) /* realtime summary */
> > > +
> > > /* Output for XFS_FS_COUNTS */
> > > typedef struct xfs_fsop_counts {
> > > __u64 freedata; /* free data section blocks */
> > > diff --git a/fs/xfs/libxfs/xfs_health.h b/fs/xfs/libxfs/xfs_health.h
> > > index 269b124dc1d7..36736d54a3e3 100644
> > > --- a/fs/xfs/libxfs/xfs_health.h
> > > +++ b/fs/xfs/libxfs/xfs_health.h
> > > @@ -39,6 +39,7 @@
> > > struct xfs_mount;
> > > struct xfs_perag;
> > > struct xfs_inode;
> > > +struct xfs_fsop_geom;
> > >
> > > /* Observable health issues for metadata spanning the entire filesystem. */
> > > #define XFS_HEALTH_FS_COUNTERS (1 << 0) /* summary counters */
> > > @@ -200,4 +201,6 @@ xfs_inode_healthy(struct xfs_inode *ip)
> > > return xfs_inode_measure_sickness(ip) == 0;
> > > }
> > >
> > > +void xfs_fsop_geom_health(struct xfs_mount *mp, struct xfs_fsop_geom *geo);
> > > +
> > > #endif /* __XFS_HEALTH_H__ */
> > > diff --git a/fs/xfs/xfs_health.c b/fs/xfs/xfs_health.c
> > > index 6e2da858c356..151c98693bef 100644
> > > --- a/fs/xfs/xfs_health.c
> > > +++ b/fs/xfs/xfs_health.c
> > > @@ -249,3 +249,30 @@ xfs_inode_measure_sickness(
> > > spin_unlock(&ip->i_flags_lock);
> > > return ret;
> > > }
> > > +
> > > +/* Fill out fs geometry health info. */
> > > +void
> > > +xfs_fsop_geom_health(
> > > + struct xfs_mount *mp,
> > > + struct xfs_fsop_geom *geo)
> > > +{
> > > + unsigned int sick;
> > > +
> > > + geo->health = 0;
> > > +
> > > + sick = xfs_fs_measure_sickness(mp);
> > > + if (sick & XFS_HEALTH_FS_COUNTERS)
> > > + geo->health |= XFS_FSOP_GEOM_HEALTH_FS_COUNTERS;
> > > + if (sick & XFS_HEALTH_FS_UQUOTA)
> > > + geo->health |= XFS_FSOP_GEOM_HEALTH_FS_UQUOTA;
> > > + if (sick & XFS_HEALTH_FS_GQUOTA)
> > > + geo->health |= XFS_FSOP_GEOM_HEALTH_FS_GQUOTA;
> > > + if (sick & XFS_HEALTH_FS_PQUOTA)
> > > + geo->health |= XFS_FSOP_GEOM_HEALTH_FS_PQUOTA;
> > > +
> > > + sick = xfs_rt_measure_sickness(mp);
> > > + if (sick & XFS_HEALTH_RT_BITMAP)
> > > + geo->health |= XFS_FSOP_GEOM_HEALTH_RT_BITMAP;
> > > + if (sick & XFS_HEALTH_RT_SUMMARY)
> > > + geo->health |= XFS_FSOP_GEOM_HEALTH_RT_SUMMARY;
> > > +}
> > > diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
> > > index b5918ce656bd..f9bf11b6a055 100644
> > > --- a/fs/xfs/xfs_ioctl.c
> > > +++ b/fs/xfs/xfs_ioctl.c
> > > @@ -34,6 +34,7 @@
> > > #include "scrub/xfs_scrub.h"
> > > #include "xfs_sb.h"
> > > #include "xfs_ag.h"
> > > +#include "xfs_health.h"
> > >
> > > #include <linux/capability.h>
> > > #include <linux/cred.h>
> > > @@ -830,6 +831,8 @@ xfs_ioc_fsgeometry(
> > > if (error)
> > > return error;
> > >
> > > + xfs_fsop_geom_health(mp, &fsgeo);
> > > +
> > > if (copy_to_user(arg, &fsgeo, sizeof(fsgeo)))
> > > return -EFAULT;
> > > return 0;
> > >
next prev parent reply other threads:[~2019-04-02 23:40 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-01 17:10 [PATCH 00/10] xfs: online health tracking support Darrick J. Wong
2019-04-01 17:10 ` [PATCH 01/10] xfs: track metadata health levels Darrick J. Wong
2019-04-02 13:22 ` Brian Foster
2019-04-02 13:30 ` Darrick J. Wong
2019-04-01 17:10 ` [PATCH 02/10] xfs: replace the BAD_SUMMARY mount flag with the equivalent health code Darrick J. Wong
2019-04-02 13:22 ` Brian Foster
2019-04-01 17:10 ` [PATCH 03/10] xfs: clear BAD_SUMMARY if unmounting an unhealthy filesystem Darrick J. Wong
2019-04-02 13:24 ` Brian Foster
2019-04-02 13:40 ` Darrick J. Wong
2019-04-02 13:53 ` Brian Foster
2019-04-02 18:16 ` Darrick J. Wong
2019-04-02 18:32 ` Brian Foster
2019-04-01 17:10 ` [PATCH 04/10] xfs: expand xfs_fsop_geom Darrick J. Wong
2019-04-02 17:34 ` Brian Foster
2019-04-02 21:53 ` Dave Chinner
2019-04-02 22:31 ` Darrick J. Wong
2019-04-01 17:10 ` [PATCH 05/10] xfs: add a new ioctl to describe allocation group geometry Darrick J. Wong
2019-04-02 17:34 ` Brian Foster
2019-04-02 21:35 ` Darrick J. Wong
2019-04-01 17:10 ` [PATCH 06/10] xfs: report fs and rt health via geometry structure Darrick J. Wong
2019-04-02 17:35 ` Brian Foster
2019-04-02 18:23 ` Darrick J. Wong
2019-04-02 23:34 ` Darrick J. Wong [this message]
2019-04-01 17:10 ` [PATCH 07/10] xfs: report AG health via AG geometry ioctl Darrick J. Wong
2019-04-03 14:30 ` Brian Foster
2019-04-03 16:11 ` Darrick J. Wong
2019-04-04 11:48 ` Brian Foster
2019-04-05 20:33 ` Darrick J. Wong
2019-04-08 11:34 ` Brian Foster
2019-04-09 3:25 ` Darrick J. Wong
2019-04-01 17:11 ` [PATCH 08/10] xfs: report inode health via bulkstat Darrick J. Wong
2019-04-01 17:11 ` [PATCH 09/10] xfs: scrub/repair should update filesystem metadata health Darrick J. Wong
2019-04-04 11:50 ` Brian Foster
2019-04-04 18:01 ` Darrick J. Wong
2019-04-05 13:07 ` Brian Foster
2019-04-05 20:54 ` Darrick J. Wong
2019-04-08 11:35 ` Brian Foster
2019-04-09 3:30 ` Darrick J. Wong
2019-04-01 17:11 ` [PATCH 10/10] xfs: update health status if we get a clean bill of health Darrick J. Wong
2019-04-04 11:51 ` Brian Foster
2019-04-04 15:48 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190402233435.GJ5147@magnolia \
--to=darrick.wong@oracle.com \
--cc=bfoster@redhat.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).