]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: create a separate finobt verifier
authorBrian Foster <bfoster@redhat.com>
Mon, 6 May 2019 22:00:28 +0000 (18:00 -0400)
committerEric Sandeen <sandeen@redhat.com>
Mon, 6 May 2019 22:00:28 +0000 (18:00 -0400)
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 <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
db/type.c
libxfs/xfs_ag.c
libxfs/xfs_ialloc_btree.c
libxfs/xfs_shared.h
mkfs/xfs_mkfs.c
repair/phase5.c
repair/scan.c

index f5f65042c878c6f72f623d0ae31d2bf3afcb7f94..7707f9dd453efd1be6847805f21a43ab98da9bff 100644 (file)
--- 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 }
 };
 
index a7d1a0d9b4bde0d411c51829526597c15183ec27..763e2fc4c21212ad615efd9654981e8accc393b3 100644 (file)
@@ -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)
index 716a81f90593501dcf3057f7a189ae176eceff63..2455ab68d6ab60ae9efbb405905899c89a03ea2b 100644 (file)
@@ -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,
index 1c5debe748f0aca5431fa45daf7fbc078270378e..9855f4d2f98fe4dcea5c36b2e3fd403c5235f9f3 100644 (file)
@@ -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;
index db3ad38ea1e0bb8831e8bcf961fe6b76ea633f9f..7229adfa79899874addcbafebb1d9aa0bb1015cd 100644 (file)
@@ -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);
index 5d9c542a44a2d02465c41b03cacf6a8b0142b463..16472a249495159d2342f00c0ed8a89a14246234 100644 (file)
@@ -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:
index edc375a9ea354ce25d479c1b03b3017f498cf6ad..7c410f5af3a742ca39bfdcfa9e41bf06d09775c6 100644 (file)
@@ -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);