All of lore.kernel.org
 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 07/10] xfs: report AG health via AG geometry ioctl
Date: Wed, 3 Apr 2019 10:30:05 -0400	[thread overview]
Message-ID: <20190403143002.GA25805@bfoster> (raw)
In-Reply-To: <155413865266.4966.1015973371094452528.stgit@magnolia>

On Mon, Apr 01, 2019 at 10:10:52AM -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>
> ---
>  fs/xfs/libxfs/xfs_fs.h     |   12 +++++++++++-
>  fs/xfs/libxfs/xfs_health.h |    2 ++
>  fs/xfs/xfs_health.c        |   40 ++++++++++++++++++++++++++++++++++++++++
>  fs/xfs/xfs_ioctl.c         |    2 ++
>  4 files changed, 55 insertions(+), 1 deletion(-)
> 
> 
...
> diff --git a/fs/xfs/xfs_health.c b/fs/xfs/xfs_health.c
> index 151c98693bef..5ca471bd41ad 100644
> --- a/fs/xfs/xfs_health.c
> +++ b/fs/xfs/xfs_health.c
> @@ -276,3 +276,43 @@ xfs_fsop_geom_health(
>  	if (sick & XFS_HEALTH_RT_SUMMARY)
>  		geo->health |= XFS_FSOP_GEOM_HEALTH_RT_SUMMARY;
>  }
> +
> +/* 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;
> +	unsigned int		sick;
> +
> +	if (agno >= mp->m_sb.sb_agcount)
> +		return;

The call to xfs_ag_get_geometry() would have already returned an error
in the ioctl path for the above scenario. It might still make sense to
check here, but perhaps we could let this function also return an int
and return an error for consistency?

> +
> +	ageo->ag_health = 0;
> +
> +	pag = xfs_perag_get(mp, agno);
> +	sick = xfs_ag_measure_sickness(pag);
> +	if (sick & XFS_HEALTH_AG_SB)
> +		ageo->ag_health |= XFS_AG_GEOM_HEALTH_AG_SB;

I'm starting to wonder whether "health" is the best term to use for the
interface bits just because it reads a little weird to measure
"sickness" and then apply all the sick state to something called
"health." I don't have a better suggestion off the top of my head,
though. Just something to think about a bit more from an API
standpoint..

Brian

> +	if (sick & XFS_HEALTH_AG_AGF)
> +		ageo->ag_health |= XFS_AG_GEOM_HEALTH_AG_AGF;
> +	if (sick & XFS_HEALTH_AG_AGFL)
> +		ageo->ag_health |= XFS_AG_GEOM_HEALTH_AG_AGFL;
> +	if (sick & XFS_HEALTH_AG_AGI)
> +		ageo->ag_health |= XFS_AG_GEOM_HEALTH_AG_AGI;
> +	if (sick & XFS_HEALTH_AG_BNOBT)
> +		ageo->ag_health |= XFS_AG_GEOM_HEALTH_AG_BNOBT;
> +	if (sick & XFS_HEALTH_AG_CNTBT)
> +		ageo->ag_health |= XFS_AG_GEOM_HEALTH_AG_CNTBT;
> +	if (sick & XFS_HEALTH_AG_INOBT)
> +		ageo->ag_health |= XFS_AG_GEOM_HEALTH_AG_INOBT;
> +	if (sick & XFS_HEALTH_AG_FINOBT)
> +		ageo->ag_health |= XFS_AG_GEOM_HEALTH_AG_FINOBT;
> +	if (sick & XFS_HEALTH_AG_RMAPBT)
> +		ageo->ag_health |= XFS_AG_GEOM_HEALTH_AG_RMAPBT;
> +	if (sick & XFS_HEALTH_AG_REFCNTBT)
> +		ageo->ag_health |= XFS_AG_GEOM_HEALTH_AG_REFCNTBT;
> +	xfs_perag_put(pag);
> +}
> diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
> index f9bf11b6a055..f1fc5e53cfc1 100644
> --- a/fs/xfs/xfs_ioctl.c
> +++ b/fs/xfs/xfs_ioctl.c
> @@ -853,6 +853,8 @@ xfs_ioc_ag_geometry(
>  	if (error)
>  		return error;
>  
> +	xfs_ag_geom_health(mp, ageo.ag_number, &ageo);
> +
>  	if (copy_to_user(arg, &ageo, sizeof(ageo)))
>  		return -EFAULT;
>  	return 0;
> 

  reply	other threads:[~2019-04-03 14:30 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
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 [this message]
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=20190403143002.GA25805@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.