From: Brian Foster Date: Mon, 6 May 2019 22:00:28 +0000 (-0400) Subject: xfs: create a separate finobt verifier X-Git-Tag: v5.1.0-rc0~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=035ae96e1f869235c4e8fd810404db5b9d07d017;p=thirdparty%2Fxfsprogs-dev.git xfs: create a separate finobt verifier Source kernel commit: 01e68f40bf7846b58d2734aa11b0cbcaadbeaa3e 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 Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- diff --git a/db/type.c b/db/type.c index f5f65042c..7707f9dd4 100644 --- a/db/type.c +++ b/db/type.c @@ -108,7 +108,7 @@ static const typ_t __typtab_crc[] = { &xfs_symlink_buf_ops, XFS_SYMLINK_CRC_OFF }, { TYP_TEXT, "text", handle_text, NULL, NULL, TYP_F_NO_CRC_OFF }, { TYP_FINOBT, "finobt", handle_struct, inobt_crc_hfld, - &xfs_inobt_buf_ops, XFS_BTREE_SBLOCK_CRC_OFF }, + &xfs_finobt_buf_ops, XFS_BTREE_SBLOCK_CRC_OFF }, { TYP_NONE, NULL } }; @@ -152,7 +152,7 @@ static const typ_t __typtab_spcrc[] = { &xfs_symlink_buf_ops, XFS_SYMLINK_CRC_OFF }, { TYP_TEXT, "text", handle_text, NULL, NULL, TYP_F_NO_CRC_OFF }, { TYP_FINOBT, "finobt", handle_struct, inobt_spcrc_hfld, - &xfs_inobt_buf_ops, XFS_BTREE_SBLOCK_CRC_OFF }, + &xfs_finobt_buf_ops, XFS_BTREE_SBLOCK_CRC_OFF }, { TYP_NONE, NULL } }; diff --git a/libxfs/xfs_ag.c b/libxfs/xfs_ag.c index a7d1a0d9b..763e2fc4c 100644 --- a/libxfs/xfs_ag.c +++ b/libxfs/xfs_ag.c @@ -362,7 +362,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/libxfs/xfs_ialloc_btree.c b/libxfs/xfs_ialloc_btree.c index 716a81f90..2455ab68d 100644 --- a/libxfs/xfs_ialloc_btree.c +++ b/libxfs/xfs_ialloc_btree.c @@ -332,6 +332,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, @@ -388,7 +395,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/libxfs/xfs_shared.h b/libxfs/xfs_shared.h index 1c5debe74..9855f4d2f 100644 --- a/libxfs/xfs_shared.h +++ b/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/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index db3ad38ea..7229adfa7 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -3678,7 +3678,7 @@ initialise_ag_headers( buf = libxfs_getbuf(mp->m_ddev_targp, XFS_AGB_TO_DADDR(mp, agno, XFS_FIBT_BLOCK(mp)), BTOBB(cfg->blocksize)); - buf->b_ops = &xfs_inobt_buf_ops; + buf->b_ops = &xfs_finobt_buf_ops; block = XFS_BUF_TO_BLOCK(buf); memset(block, 0, cfg->blocksize); libxfs_btree_init_block(mp, buf, XFS_BTNUM_FINO, 0, 0, agno, 0); diff --git a/repair/phase5.c b/repair/phase5.c index 5d9c542a4..16472a249 100644 --- a/repair/phase5.c +++ b/repair/phase5.c @@ -625,8 +625,9 @@ btnum_to_ops( case XFS_BTNUM_CNT: return &xfs_allocbt_buf_ops; case XFS_BTNUM_INO: - case XFS_BTNUM_FINO: return &xfs_inobt_buf_ops; + case XFS_BTNUM_FINO: + return &xfs_finobt_buf_ops; case XFS_BTNUM_RMAP: return &xfs_rmapbt_buf_ops; case XFS_BTNUM_REFC: diff --git a/repair/scan.c b/repair/scan.c index edc375a9e..7c410f5af 100644 --- a/repair/scan.c +++ b/repair/scan.c @@ -2289,7 +2289,7 @@ validate_agi( XFS_FIBT_CRC_MAGIC : XFS_FIBT_MAGIC; scan_sbtree(bno, be32_to_cpu(agi->agi_free_level), agno, 0, scan_inobt, 1, magic, agcnts, - &xfs_inobt_buf_ops); + &xfs_finobt_buf_ops); } else { do_warn(_("bad agbno %u for finobt root, agno %d\n"), be32_to_cpu(agi->agi_free_root), agno);