public inbox for linux-xfs@vger.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 3/5] xfs: support inode btree blockcounts in online scrub
Date: Mon, 31 Aug 2020 15:06:53 -0400	[thread overview]
Message-ID: <20200831190653.GE12035@bfoster> (raw)
In-Reply-To: <159858220970.3058056.11436591208519179894.stgit@magnolia>

On Thu, Aug 27, 2020 at 07:36:49PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Add the necessary bits to the online scrub code to check the inode btree
> counters when enabled.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---

Looks reasonable:

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

>  fs/xfs/scrub/agheader.c |   30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> 
> diff --git a/fs/xfs/scrub/agheader.c b/fs/xfs/scrub/agheader.c
> index e9bcf1faa183..ae8e2e0ac64a 100644
> --- a/fs/xfs/scrub/agheader.c
> +++ b/fs/xfs/scrub/agheader.c
> @@ -781,6 +781,35 @@ xchk_agi_xref_icounts(
>  		xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp);
>  }
>  
> +/* Check agi_[fi]blocks against tree size */
> +static inline void
> +xchk_agi_xref_fiblocks(
> +	struct xfs_scrub	*sc)
> +{
> +	struct xfs_agi		*agi = sc->sa.agi_bp->b_addr;
> +	xfs_agblock_t		blocks;
> +	int			error = 0;
> +
> +	if (!xfs_sb_version_hasinobtcounts(&sc->mp->m_sb))
> +		return;
> +
> +	if (sc->sa.ino_cur) {
> +		error = xfs_btree_count_blocks(sc->sa.ino_cur, &blocks);
> +		if (!xchk_should_check_xref(sc, &error, &sc->sa.ino_cur))
> +			return;
> +		if (blocks != be32_to_cpu(agi->agi_iblocks))
> +			xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp);
> +	}
> +
> +	if (sc->sa.fino_cur) {
> +		error = xfs_btree_count_blocks(sc->sa.fino_cur, &blocks);
> +		if (!xchk_should_check_xref(sc, &error, &sc->sa.fino_cur))
> +			return;
> +		if (blocks != be32_to_cpu(agi->agi_fblocks))
> +			xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp);
> +	}
> +}
> +
>  /* Cross-reference with the other btrees. */
>  STATIC void
>  xchk_agi_xref(
> @@ -804,6 +833,7 @@ xchk_agi_xref(
>  	xchk_agi_xref_icounts(sc);
>  	xchk_xref_is_owned_by(sc, agbno, 1, &XFS_RMAP_OINFO_FS);
>  	xchk_xref_is_not_shared(sc, agbno, 1);
> +	xchk_agi_xref_fiblocks(sc);
>  
>  	/* scrub teardown will take care of sc->sa for us */
>  }
> 


  reply	other threads:[~2020-08-31 19:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-28  2:36 [PATCH v3 0/5] xfs: add inode btree blocks counters to the AGI header Darrick J. Wong
2020-08-28  2:36 ` [PATCH 1/5] xfs: store inode btree block counts in " Darrick J. Wong
2020-08-31 19:06   ` Brian Foster
2020-08-31 19:40     ` Darrick J. Wong
2020-08-28  2:36 ` [PATCH 2/5] xfs: use the finobt block counts to speed up mount times Darrick J. Wong
2020-08-31 19:06   ` Brian Foster
2020-08-28  2:36 ` [PATCH 3/5] xfs: support inode btree blockcounts in online scrub Darrick J. Wong
2020-08-31 19:06   ` Brian Foster [this message]
2020-08-28  2:36 ` [PATCH 4/5] xfs: support inode btree blockcounts in online repair Darrick J. Wong
2020-08-31 19:07   ` Brian Foster
2020-08-31 19:40     ` Darrick J. Wong
2020-08-28  2:37 ` [PATCH 5/5] xfs: enable new inode btree counters feature Darrick J. Wong
2020-08-31 19:07   ` Brian Foster
  -- strict thread matches above, loose matches on Subject: below --
2020-09-02  2:55 [PATCH v4 0/5] xfs: add inode btree blocks counters to the AGI header Darrick J. Wong
2020-09-02  2:56 ` [PATCH 3/5] xfs: support inode btree blockcounts in online scrub 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=20200831190653.GE12035@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