xfs: create a separate finobt verifier

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>
This commit is contained in:
Brian Foster 2019-02-07 10:45:46 -08:00 committed by Darrick J. Wong
parent e34d3e74eb
commit 01e68f40bf
5 changed files with 15 additions and 5 deletions

View File

@ -361,7 +361,7 @@ xfs_ag_init_headers(
{ /* FINO root block */ { /* FINO root block */
.daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_FIBT_BLOCK(mp)), .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_FIBT_BLOCK(mp)),
.numblks = BTOBB(mp->m_sb.sb_blocksize), .numblks = BTOBB(mp->m_sb.sb_blocksize),
.ops = &xfs_inobt_buf_ops, .ops = &xfs_finobt_buf_ops,
.work = &xfs_btroot_init, .work = &xfs_btroot_init,
.type = XFS_BTNUM_FINO, .type = XFS_BTNUM_FINO,
.need_init = xfs_sb_version_hasfinobt(&mp->m_sb) .need_init = xfs_sb_version_hasfinobt(&mp->m_sb)

View File

@ -333,6 +333,13 @@ const struct xfs_buf_ops xfs_inobt_buf_ops = {
.verify_struct = xfs_inobt_verify, .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 STATIC int
xfs_inobt_keys_inorder( xfs_inobt_keys_inorder(
struct xfs_btree_cur *cur, 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_rec_from_cur = xfs_inobt_init_rec_from_cur,
.init_ptr_from_cur = xfs_finobt_init_ptr_from_cur, .init_ptr_from_cur = xfs_finobt_init_ptr_from_cur,
.key_diff = xfs_inobt_key_diff, .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, .diff_two_keys = xfs_inobt_diff_two_keys,
.keys_inorder = xfs_inobt_keys_inorder, .keys_inorder = xfs_inobt_keys_inorder,
.recs_inorder = xfs_inobt_recs_inorder, .recs_inorder = xfs_inobt_recs_inorder,

View 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_symlink_buf_ops;
extern const struct xfs_buf_ops xfs_agi_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_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_ops;
extern const struct xfs_buf_ops xfs_inode_buf_ra_ops; extern const struct xfs_buf_ops xfs_inode_buf_ra_ops;
extern const struct xfs_buf_ops xfs_dquot_buf_ops; extern const struct xfs_buf_ops xfs_dquot_buf_ops;

View File

@ -879,7 +879,7 @@ xrep_agi(
}, },
[XREP_AGI_FINOBT] = { [XREP_AGI_FINOBT] = {
.rmap_owner = XFS_RMAP_OWN_INOBT, .rmap_owner = XFS_RMAP_OWN_INOBT,
.buf_ops = &xfs_inobt_buf_ops, .buf_ops = &xfs_finobt_buf_ops,
.magic = XFS_FIBT_CRC_MAGIC, .magic = XFS_FIBT_CRC_MAGIC,
}, },
[XREP_AGI_END] = { [XREP_AGI_END] = {

View File

@ -2445,11 +2445,13 @@ xlog_recover_validate_buf_type(
bp->b_ops = &xfs_allocbt_buf_ops; bp->b_ops = &xfs_allocbt_buf_ops;
break; break;
case XFS_IBT_CRC_MAGIC: case XFS_IBT_CRC_MAGIC:
case XFS_FIBT_CRC_MAGIC:
case XFS_IBT_MAGIC: case XFS_IBT_MAGIC:
case XFS_FIBT_MAGIC:
bp->b_ops = &xfs_inobt_buf_ops; bp->b_ops = &xfs_inobt_buf_ops;
break; 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_CRC_MAGIC:
case XFS_BMAP_MAGIC: case XFS_BMAP_MAGIC:
bp->b_ops = &xfs_bmbt_buf_ops; bp->b_ops = &xfs_bmbt_buf_ops;