linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 7/8] xfs: report AG health via AG geometry ioctl
Date: Fri, 12 Apr 2019 07:14:40 -0400	[thread overview]
Message-ID: <20190412111440.GB50446@bfoster> (raw)
In-Reply-To: <155505052747.1279757.8384383083144164193.stgit@magnolia>

On Thu, Apr 11, 2019 at 11:28:47PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Use the AG geometry info ioctl to report health status too.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/libxfs/xfs_ag.c     |    2 ++
>  fs/xfs/libxfs/xfs_fs.h     |   14 +++++++++++++-
>  fs/xfs/libxfs/xfs_health.h |    1 +
>  fs/xfs/xfs_health.c        |   36 ++++++++++++++++++++++++++++++++++++
>  4 files changed, 52 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/fs/xfs/libxfs/xfs_ag.c b/fs/xfs/libxfs/xfs_ag.c
> index 1c0f2a6c10b4..b0c89f54d1bb 100644
> --- a/fs/xfs/libxfs/xfs_ag.c
> +++ b/fs/xfs/libxfs/xfs_ag.c
> @@ -20,6 +20,7 @@
>  #include "xfs_rmap.h"
>  #include "xfs_ag.h"
>  #include "xfs_ag_resv.h"
> +#include "xfs_health.h"
>  
>  static struct xfs_buf *
>  xfs_get_aghdr_buf(
> @@ -505,6 +506,7 @@ xfs_ag_get_geometry(
>  		   pag->pagf_btreeblks -
>  		   xfs_ag_resv_needed(pag, XFS_AG_RESV_NONE);
>  	ageo->ag_freeblks = freeblks;
> +	xfs_ag_geom_health(pag, ageo);
>  
>  	/* Release resources. */
>  	xfs_perag_put(pag);
> diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h
> index 6b8956dbf49d..35d60f8017cd 100644
> --- a/fs/xfs/libxfs/xfs_fs.h
> +++ b/fs/xfs/libxfs/xfs_fs.h
> @@ -285,9 +285,21 @@ struct xfs_ag_geometry {
>  	uint32_t	ag_freeblks;	/* o: free space */
>  	uint32_t	ag_icount;	/* o: inodes allocated */
>  	uint32_t	ag_ifree;	/* o: inodes free */
> +	uint32_t	ag_sick;	/* o: sick things in ag */
> +	uint32_t	ag_checked;	/* o: checked metadata in ag */
>  	uint32_t	ag_reserved32;	/* o: zero */
> -	uint64_t	ag_reserved[13];/* o: zero */
> +	uint64_t	ag_reserved[12];/* o: zero */
>  };
> +#define XFS_AG_GEOM_SICK_SB	(1 << 0)  /* superblock */
> +#define XFS_AG_GEOM_SICK_AGF	(1 << 1)  /* AGF header */
> +#define XFS_AG_GEOM_SICK_AGFL	(1 << 2)  /* AGFL header */
> +#define XFS_AG_GEOM_SICK_AGI	(1 << 3)  /* AGI header */
> +#define XFS_AG_GEOM_SICK_BNOBT	(1 << 4)  /* free space by block */
> +#define XFS_AG_GEOM_SICK_CNTBT	(1 << 5)  /* free space by length */
> +#define XFS_AG_GEOM_SICK_INOBT	(1 << 6)  /* inode index */
> +#define XFS_AG_GEOM_SICK_FINOBT	(1 << 7)  /* free inode index */
> +#define XFS_AG_GEOM_SICK_RMAPBT	(1 << 8)  /* reverse mappings */
> +#define XFS_AG_GEOM_SICK_REFCNTBT (1 << 9)  /* reference counts */
>  
>  /*
>   * Structures for XFS_IOC_FSGROWFSDATA, XFS_IOC_FSGROWFSLOG & XFS_IOC_FSGROWFSRT
> diff --git a/fs/xfs/libxfs/xfs_health.h b/fs/xfs/libxfs/xfs_health.h
> index 3fffdcc80970..e392457023a4 100644
> --- a/fs/xfs/libxfs/xfs_health.h
> +++ b/fs/xfs/libxfs/xfs_health.h
> @@ -184,5 +184,6 @@ xfs_inode_is_healthy(struct xfs_inode *ip)
>  }
>  
>  void xfs_fsop_geom_health(struct xfs_mount *mp, struct xfs_fsop_geom *geo);
> +void xfs_ag_geom_health(struct xfs_perag *pag, struct xfs_ag_geometry *ageo);
>  
>  #endif	/* __XFS_HEALTH_H__ */
> diff --git a/fs/xfs/xfs_health.c b/fs/xfs/xfs_health.c
> index d137b8f13869..5431c4070f27 100644
> --- a/fs/xfs/xfs_health.c
> +++ b/fs/xfs/xfs_health.c
> @@ -320,3 +320,39 @@ xfs_fsop_geom_health(
>  	for (m = rt_map; m->sick_mask; m++)
>  		xfgeo_health_tick(geo, sick, checked, m);
>  }
> +
> +static const struct ioctl_sick_map ag_map[] = {
> +	{ XFS_SICK_AG_SB,	XFS_AG_GEOM_SICK_SB },
> +	{ XFS_SICK_AG_AGF,	XFS_AG_GEOM_SICK_AGF },
> +	{ XFS_SICK_AG_AGFL,	XFS_AG_GEOM_SICK_AGFL },
> +	{ XFS_SICK_AG_AGI,	XFS_AG_GEOM_SICK_AGI },
> +	{ XFS_SICK_AG_BNOBT,	XFS_AG_GEOM_SICK_BNOBT },
> +	{ XFS_SICK_AG_CNTBT,	XFS_AG_GEOM_SICK_CNTBT },
> +	{ XFS_SICK_AG_INOBT,	XFS_AG_GEOM_SICK_INOBT },
> +	{ XFS_SICK_AG_FINOBT,	XFS_AG_GEOM_SICK_FINOBT },
> +	{ XFS_SICK_AG_RMAPBT,	XFS_AG_GEOM_SICK_RMAPBT },
> +	{ XFS_SICK_AG_REFCNTBT,	XFS_AG_GEOM_SICK_REFCNTBT },
> +	{ 0, 0 },
> +};
> +
> +/* Fill out ag geometry health info. */
> +void
> +xfs_ag_geom_health(
> +	struct xfs_perag		*pag,
> +	struct xfs_ag_geometry		*ageo)
> +{
> +	const struct ioctl_sick_map	*m;
> +	unsigned int			sick;
> +	unsigned int			checked;
> +
> +	ageo->ag_sick = 0;
> +	ageo->ag_checked = 0;
> +
> +	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;
> +	}
> +}
> 

  reply	other threads:[~2019-04-12 11:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12  6:28 [PATCH v3 0/8] xfs: online health tracking support Darrick J. Wong
2019-04-12  6:28 ` [PATCH 1/8] xfs: track metadata health status Darrick J. Wong
2019-04-12  6:28 ` [PATCH 2/8] xfs: replace the BAD_SUMMARY mount flag with the equivalent health code Darrick J. Wong
2019-04-12  6:28 ` [PATCH 3/8] xfs: clear BAD_SUMMARY if unmounting an unhealthy filesystem Darrick J. Wong
2019-04-12  6:28 ` [PATCH 4/8] xfs: bump XFS_IOC_FSGEOMETRY to v5 structures Darrick J. Wong
2019-04-12  6:28 ` [PATCH 5/8] xfs: add a new ioctl to describe allocation group geometry Darrick J. Wong
2019-04-12  6:28 ` [PATCH 6/8] xfs: report fs and rt health via geometry structure Darrick J. Wong
2019-04-12 11:14   ` Brian Foster
2019-04-12  6:28 ` [PATCH 7/8] xfs: report AG health via AG geometry ioctl Darrick J. Wong
2019-04-12 11:14   ` Brian Foster [this message]
2019-04-12  6:28 ` [PATCH 8/8] xfs: report inode health via bulkstat Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2019-04-11  1:45 [PATCH v2 0/8] xfs: online health tracking support Darrick J. Wong
2019-04-11  1:46 ` [PATCH 7/8] xfs: report AG health via AG geometry ioctl Darrick J. Wong
2019-04-11 13:09   ` Brian Foster
2019-04-11 15:33     ` 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=20190412111440.GB50446@bfoster \
    --to=bfoster@redhat.com \
    --cc=darrick.wong@oracle.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).