From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 11/8] xfs: use buf ops magic to detect btree block type
Date: Thu, 7 Feb 2019 15:27:13 -0500 [thread overview]
Message-ID: <20190207202713.GF61958@bfoster> (raw)
In-Reply-To: <20190207185713.GI7991@magnolia>
On Thu, Feb 07, 2019 at 10:57:13AM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Now that we encode block magic numbers in all the buffer ops, use that
> for block type detection in the ag header repair code instead of
> encoding magics directly in the repair code.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
Reviewed-by: Brian Foster <bfoster@redhat.com>
> fs/xfs/scrub/agheader_repair.c | 6 ------
> fs/xfs/scrub/repair.c | 3 ++-
> fs/xfs/scrub/repair.h | 3 ---
> 3 files changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/fs/xfs/scrub/agheader_repair.c b/fs/xfs/scrub/agheader_repair.c
> index 2799d1531639..64e31f87d490 100644
> --- a/fs/xfs/scrub/agheader_repair.c
> +++ b/fs/xfs/scrub/agheader_repair.c
> @@ -342,22 +342,18 @@ xrep_agf(
> [XREP_AGF_BNOBT] = {
> .rmap_owner = XFS_RMAP_OWN_AG,
> .buf_ops = &xfs_bnobt_buf_ops,
> - .magic = XFS_ABTB_CRC_MAGIC,
> },
> [XREP_AGF_CNTBT] = {
> .rmap_owner = XFS_RMAP_OWN_AG,
> .buf_ops = &xfs_cntbt_buf_ops,
> - .magic = XFS_ABTC_CRC_MAGIC,
> },
> [XREP_AGF_RMAPBT] = {
> .rmap_owner = XFS_RMAP_OWN_AG,
> .buf_ops = &xfs_rmapbt_buf_ops,
> - .magic = XFS_RMAP_CRC_MAGIC,
> },
> [XREP_AGF_REFCOUNTBT] = {
> .rmap_owner = XFS_RMAP_OWN_REFC,
> .buf_ops = &xfs_refcountbt_buf_ops,
> - .magic = XFS_REFC_CRC_MAGIC,
> },
> [XREP_AGF_END] = {
> .buf_ops = NULL,
> @@ -875,12 +871,10 @@ xrep_agi(
> [XREP_AGI_INOBT] = {
> .rmap_owner = XFS_RMAP_OWN_INOBT,
> .buf_ops = &xfs_inobt_buf_ops,
> - .magic = XFS_IBT_CRC_MAGIC,
> },
> [XREP_AGI_FINOBT] = {
> .rmap_owner = XFS_RMAP_OWN_INOBT,
> .buf_ops = &xfs_finobt_buf_ops,
> - .magic = XFS_FIBT_CRC_MAGIC,
> },
> [XREP_AGI_END] = {
> .buf_ops = NULL
> diff --git a/fs/xfs/scrub/repair.c b/fs/xfs/scrub/repair.c
> index 6acf1bfa0bfe..f28f4bad317b 100644
> --- a/fs/xfs/scrub/repair.c
> +++ b/fs/xfs/scrub/repair.c
> @@ -743,7 +743,8 @@ xrep_findroot_block(
>
> /* Ensure the block magic matches the btree type we're looking for. */
> btblock = XFS_BUF_TO_BLOCK(bp);
> - if (be32_to_cpu(btblock->bb_magic) != fab->magic)
> + ASSERT(fab->buf_ops->magic[1] != 0);
> + if (btblock->bb_magic != fab->buf_ops->magic[1])
> goto out;
>
> /*
> diff --git a/fs/xfs/scrub/repair.h b/fs/xfs/scrub/repair.h
> index f2fc18bb7605..d990314eb08b 100644
> --- a/fs/xfs/scrub/repair.h
> +++ b/fs/xfs/scrub/repair.h
> @@ -42,9 +42,6 @@ struct xrep_find_ag_btree {
> /* in: buffer ops */
> const struct xfs_buf_ops *buf_ops;
>
> - /* in: magic number of the btree */
> - uint32_t magic;
> -
> /* out: the highest btree block found and the tree height */
> xfs_agblock_t root;
> unsigned int height;
prev parent reply other threads:[~2019-02-07 20:27 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-07 18:40 [PATCH v4 0/8] xfs: fix [f]inobt magic value verification Brian Foster
2019-02-07 18:40 ` [PATCH v4 1/8] xfs: always check magic values in on-disk byte order Brian Foster
2019-02-07 18:55 ` [PATCH 0.5/8] xfs: clarify documentation for the function to reverify buffers Darrick J. Wong
2019-02-07 18:40 ` [PATCH v4 2/8] xfs: create a separate finobt verifier Brian Foster
2019-02-07 18:41 ` [PATCH v4 3/8] xfs: distinguish between inobt and finobt magic values Brian Foster
2019-02-07 18:52 ` Darrick J. Wong
2019-02-07 18:59 ` Brian Foster
2019-02-07 18:41 ` [PATCH v4 4/8] xfs: split up allocation btree verifier Brian Foster
2019-02-07 18:41 ` [PATCH v4 5/8] xfs: distinguish between bnobt and cntbt magic values Brian Foster
2019-02-07 18:41 ` [PATCH v4 6/8] xfs: use verifier magic field in dir2 leaf verifiers Brian Foster
2019-02-07 19:10 ` Darrick J. Wong
2019-02-07 19:37 ` Brian Foster
2019-02-07 20:10 ` [PATCH v4.1] " Brian Foster
2019-02-07 18:41 ` [PATCH v4 7/8] xfs: miscellaneous verifier magic value fixups Brian Foster
2019-02-07 19:13 ` Darrick J. Wong
2019-02-07 19:42 ` Brian Foster
2019-02-07 20:11 ` [PATCH v4.1] " Brian Foster
2019-02-07 18:41 ` [PATCH v4 8/8] xfs: factor xfs_da3_blkinfo verification into common helper Brian Foster
2019-02-07 18:56 ` [PATCH 9/8] xfs: add inode magic to inode verifier Darrick J. Wong
2019-02-07 20:27 ` Brian Foster
2019-02-07 18:56 ` [PATCH 10/8] xfs: add magic numbers to dquot buffer ops Darrick J. Wong
2019-02-07 20:27 ` Brian Foster
2019-02-07 18:57 ` [PATCH 11/8] xfs: use buf ops magic to detect btree block type Darrick J. Wong
2019-02-07 20:27 ` Brian Foster [this message]
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=20190207202713.GF61958@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).