public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Brian Foster <bfoster@redhat.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH v3 3/9] xfs: create a separate finobt verifier
Date: Wed, 6 Feb 2019 10:09:48 -0800	[thread overview]
Message-ID: <20190206180948.GR7991@magnolia> (raw)
In-Reply-To: <20190204145231.47034-4-bfoster@redhat.com>

On Mon, Feb 04, 2019 at 09:52:25AM -0500, Brian Foster wrote:
> The inobt verifier is reused for the inobt and finobt, which
> prevents the ability to distinguish between magic values on a
> per-tree basis. Create a separate finobt structure in preparation
> for changes to enforce the appropriate magic value for the
> associated tree. This patch has no functional change.
> 
> Signed-off-by: Brian Foster <bfoster@redhat.com>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/libxfs/xfs_ag.c           | 2 +-
>  fs/xfs/libxfs/xfs_ialloc_btree.c | 9 ++++++++-
>  fs/xfs/libxfs/xfs_shared.h       | 1 +
>  fs/xfs/scrub/agheader_repair.c   | 2 +-
>  fs/xfs/xfs_log_recover.c         | 6 ++++--
>  5 files changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_ag.c b/fs/xfs/libxfs/xfs_ag.c
> index 999ad8d00d43..bde67ef3ff43 100644
> --- a/fs/xfs/libxfs/xfs_ag.c
> +++ b/fs/xfs/libxfs/xfs_ag.c
> @@ -361,7 +361,7 @@ xfs_ag_init_headers(
>  	{ /* FINO root block */
>  		.daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_FIBT_BLOCK(mp)),
>  		.numblks = BTOBB(mp->m_sb.sb_blocksize),
> -		.ops = &xfs_inobt_buf_ops,
> +		.ops = &xfs_finobt_buf_ops,
>  		.work = &xfs_btroot_init,
>  		.type = XFS_BTNUM_FINO,
>  		.need_init =  xfs_sb_version_hasfinobt(&mp->m_sb)
> diff --git a/fs/xfs/libxfs/xfs_ialloc_btree.c b/fs/xfs/libxfs/xfs_ialloc_btree.c
> index 9b25e7a0df47..798269eb4767 100644
> --- a/fs/xfs/libxfs/xfs_ialloc_btree.c
> +++ b/fs/xfs/libxfs/xfs_ialloc_btree.c
> @@ -333,6 +333,13 @@ const struct xfs_buf_ops xfs_inobt_buf_ops = {
>  	.verify_struct = xfs_inobt_verify,
>  };
>  
> +const struct xfs_buf_ops xfs_finobt_buf_ops = {
> +	.name = "xfs_finobt",
> +	.verify_read = xfs_inobt_read_verify,
> +	.verify_write = xfs_inobt_write_verify,
> +	.verify_struct = xfs_inobt_verify,
> +};
> +
>  STATIC int
>  xfs_inobt_keys_inorder(
>  	struct xfs_btree_cur	*cur,
> @@ -389,7 +396,7 @@ static const struct xfs_btree_ops xfs_finobt_ops = {
>  	.init_rec_from_cur	= xfs_inobt_init_rec_from_cur,
>  	.init_ptr_from_cur	= xfs_finobt_init_ptr_from_cur,
>  	.key_diff		= xfs_inobt_key_diff,
> -	.buf_ops		= &xfs_inobt_buf_ops,
> +	.buf_ops		= &xfs_finobt_buf_ops,
>  	.diff_two_keys		= xfs_inobt_diff_two_keys,
>  	.keys_inorder		= xfs_inobt_keys_inorder,
>  	.recs_inorder		= xfs_inobt_recs_inorder,
> diff --git a/fs/xfs/libxfs/xfs_shared.h b/fs/xfs/libxfs/xfs_shared.h
> index 1c5debe748f0..9855f4d2f98f 100644
> --- a/fs/xfs/libxfs/xfs_shared.h
> +++ b/fs/xfs/libxfs/xfs_shared.h
> @@ -36,6 +36,7 @@ extern const struct xfs_buf_ops xfs_dquot_buf_ops;
>  extern const struct xfs_buf_ops xfs_symlink_buf_ops;
>  extern const struct xfs_buf_ops xfs_agi_buf_ops;
>  extern const struct xfs_buf_ops xfs_inobt_buf_ops;
> +extern const struct xfs_buf_ops xfs_finobt_buf_ops;
>  extern const struct xfs_buf_ops xfs_inode_buf_ops;
>  extern const struct xfs_buf_ops xfs_inode_buf_ra_ops;
>  extern const struct xfs_buf_ops xfs_dquot_buf_ops;
> diff --git a/fs/xfs/scrub/agheader_repair.c b/fs/xfs/scrub/agheader_repair.c
> index 03d1e15cceba..673be3cf7b8d 100644
> --- a/fs/xfs/scrub/agheader_repair.c
> +++ b/fs/xfs/scrub/agheader_repair.c
> @@ -879,7 +879,7 @@ xrep_agi(
>  		},
>  		[XREP_AGI_FINOBT] = {
>  			.rmap_owner = XFS_RMAP_OWN_INOBT,
> -			.buf_ops = &xfs_inobt_buf_ops,
> +			.buf_ops = &xfs_finobt_buf_ops,
>  			.magic = XFS_FIBT_CRC_MAGIC,
>  		},
>  		[XREP_AGI_END] = {
> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index 9fe88d125f0a..228c754bb137 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -2445,11 +2445,13 @@ xlog_recover_validate_buf_type(
>  			bp->b_ops = &xfs_allocbt_buf_ops;
>  			break;
>  		case XFS_IBT_CRC_MAGIC:
> -		case XFS_FIBT_CRC_MAGIC:
>  		case XFS_IBT_MAGIC:
> -		case XFS_FIBT_MAGIC:
>  			bp->b_ops = &xfs_inobt_buf_ops;
>  			break;
> +		case XFS_FIBT_CRC_MAGIC:
> +		case XFS_FIBT_MAGIC:
> +			bp->b_ops = &xfs_finobt_buf_ops;
> +			break;
>  		case XFS_BMAP_CRC_MAGIC:
>  		case XFS_BMAP_MAGIC:
>  			bp->b_ops = &xfs_bmbt_buf_ops;
> -- 
> 2.17.2
> 

  reply	other threads:[~2019-02-06 18:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-04 14:52 [PATCH v3 0/9] xfs: fix [f]inobt magic value verification Brian Foster
2019-02-04 14:52 ` [PATCH v3 1/9] xfs: set buffer ops when repair probes for btree type Brian Foster
2019-02-06 18:08   ` Darrick J. Wong
2019-02-06 18:40     ` Brian Foster
2019-02-04 14:52 ` [PATCH v3 2/9] xfs: always check magic values in on-disk byte order Brian Foster
2019-02-06 17:08   ` Darrick J. Wong
2019-02-04 14:52 ` [PATCH v3 3/9] xfs: create a separate finobt verifier Brian Foster
2019-02-06 18:09   ` Darrick J. Wong [this message]
2019-02-04 14:52 ` [PATCH v3 4/9] xfs: distinguish between inobt and finobt magic values Brian Foster
2019-02-06 18:12   ` Darrick J. Wong
2019-02-04 14:52 ` [PATCH v3 5/9] xfs: split up allocation btree verifier Brian Foster
2019-02-06 18:15   ` Darrick J. Wong
2019-02-04 14:52 ` [PATCH v3 6/9] xfs: distinguish between bnobt and cntbt magic values Brian Foster
2019-02-06 18:15   ` Darrick J. Wong
2019-02-04 14:52 ` [PATCH v3 7/9] xfs: use verifier magic field in dir2 leaf verifiers Brian Foster
2019-02-06 17:45   ` Darrick J. Wong
2019-02-06 18:41     ` Brian Foster
2019-02-06 19:03       ` Darrick J. Wong
2019-02-06 19:18         ` Brian Foster
2019-02-04 14:52 ` [PATCH v3 8/9] xfs: miscellaneous verifier magic value fixups Brian Foster
2019-02-06 17:52   ` Darrick J. Wong
2019-02-04 14:52 ` [PATCH v3 9/9] xfs: factor xfs_da3_blkinfo verification into common helper Brian Foster
2019-02-06 18:16   ` Darrick J. Wong
2019-02-06 18:23 ` [PATCH v3 0/9] xfs: fix [f]inobt magic value verification Darrick J. Wong
2019-02-06 18:50   ` Brian Foster
2019-02-06 19:05     ` Darrick J. Wong
2019-02-06 19:18       ` Brian Foster

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=20190206180948.GR7991@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