[PATCH 9/9] xfs: remove unnecessary fields in xfbtree_config

Darrick J. Wong
2023-12-31T20:19:18Z

Remove these fields now that we get all the info we need from the btree
ops.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
fs/xfs/libxfs/xfs_btree_mem.h | 9 ---------
fs/xfs/libxfs/xfs_rmap_btree.c | 1 -
fs/xfs/scrub/trace.h | 10 ++++------
fs/xfs/scrub/xfbtree.c | 4 ++--
4 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_btree_mem.h b/fs/xfs/libxfs/xfs_btree_mem.h
index 29f97c5030465..1f961f3f55444 100644
--- a/fs/xfs/libxfs/xfs_btree_mem.h
+++ b/fs/xfs/libxfs/xfs_btree_mem.h
@@ -17,17 +17,8 @@ struct xfbtree_config {

/* Owner of this btree. */
unsigned long long owner;
-
- /* Btree type number */
- xfs_btnum_t btnum;
-
- /* XFBTREE_CREATE_* flags */
- unsigned int flags;
};

-/* btree has long pointers */
-#define XFBTREE_CREATE_LONG_PTRS (1U << 0)
-
#ifdef CONFIG_XFS_BTREE_IN_XFILE
unsigned int xfs_btree_mem_head_nlevels(struct xfs_buf *head_bp);

diff --git a/fs/xfs/libxfs/xfs_rmap_btree.c b/fs/xfs/libxfs/xfs_rmap_btree.c
index f5889da0bff76..b4a8b4b62456b 100644
--- a/fs/xfs/libxfs/xfs_rmap_btree.c
+++ b/fs/xfs/libxfs/xfs_rmap_btree.c
@@ -669,7 +669,6 @@ xfs_rmapbt_mem_create(
struct xfbtree_config cfg = {
.btree_ops = &xfs_rmapbt_mem_ops,
.target = target,
- .btnum = XFS_BTNUM_RMAP,
.owner = agno,
};

diff --git a/fs/xfs/scrub/trace.h b/fs/xfs/scrub/trace.h
index 06d593dcd697a..14bbefdd7ab81 100644
--- a/fs/xfs/scrub/trace.h
+++ b/fs/xfs/scrub/trace.h
@@ -2218,8 +2218,7 @@ TRACE_EVENT(xfbtree_create,
struct xfbtree *xfbt),
TP_ARGS(mp, cfg, xfbt),
TP_STRUCT__entry(
- __field(xfs_btnum_t, btnum)
- __field(unsigned int, xfbtree_flags)
+ __field(const void *, btree_ops)
__field(unsigned long, xfino)
__field(unsigned int, leaf_mxr)
__field(unsigned int, leaf_mnr)
@@ -2228,8 +2227,7 @@ TRACE_EVENT(xfbtree_create,
__field(unsigned long long, owner)
),
TP_fast_assign(
- __entry->btnum = cfg->btnum;
- __entry->xfbtree_flags = cfg->flags;
+ __entry->btree_ops = cfg->btree_ops;
__entry->xfino = xfbtree_ino(xfbt);
__entry->leaf_mxr = xfbt->maxrecs[0];
__entry->node_mxr = xfbt->maxrecs[1];
@@ -2237,9 +2235,9 @@ TRACE_EVENT(xfbtree_create,
__entry->node_mnr = xfbt->minrecs[1];
__entry->owner = cfg->owner;
),
- TP_printk("xfino 0x%lx btnum %s owner 0x%llx leaf_mxr %u leaf_mnr %u node_mxr %u node_mnr %u",
+ TP_printk("xfino 0x%lx btree_ops %pS owner 0x%llx leaf_mxr %u leaf_mnr %u node_mxr %u node_mnr %u",
__entry->xfino,
- __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
+ __entry->btree_ops,
__entry->owner,
__entry->leaf_mxr,
__entry->leaf_mnr,
diff --git a/fs/xfs/scrub/xfbtree.c b/fs/xfs/scrub/xfbtree.c
index 9d2e01614d1ff..016026947019a 100644
--- a/fs/xfs/scrub/xfbtree.c
+++ b/fs/xfs/scrub/xfbtree.c
@@ -414,7 +414,7 @@ xfbtree_rec_bytes(
{
unsigned int blocklen = xfo_to_b(1);

- if (cfg->flags & XFBTREE_CREATE_LONG_PTRS) {
+ if (cfg->btree_ops->geom_flags & XFS_BTREE_LONG_PTRS) {
if (xfs_has_crc(mp))
return blocklen - XFS_BTREE_LBLOCK_CRC_LEN;

@@ -504,7 +504,7 @@ xfbtree_create(
xfboff_bitmap_init(&xfbt->freespace);

/* Set up min/maxrecs for this btree. */
- if (cfg->flags & XFBTREE_CREATE_LONG_PTRS)
+ if (cfg->btree_ops->geom_flags & XFS_BTREE_LONG_PTRS)
keyptr_len += sizeof(__be64);
else
keyptr_len += sizeof(__be32);