[PATCHSET v29.0 10/28] xfs: move btree geometry to ops struct

Darrick J. Wong
2023-12-31T19:27:58Z

Hi all,

This patchset prepares the generic btree code to allow for the creation
of new btree types outside of libxfs. The end goal here is for online
fsck to be able to create its own in-memory btrees that will be used to
improve the performance (and reduce the memory requirements of) the
refcount btree.

To enable this, I decided that the btree ops structure is the ideal
place to encode all of the geometry information about a btree. The btree
ops struture already contains the buffer ops (and hence the btree block
magic numbers) as well as the key and record sizes, so it doesn't seem
all that farfetched to encode the XFS_BTREE_ flags that determine the
geometry (ROOT_IN_INODE, LONG_PTRS, etc).

The rest of the patchset cleans up the btree functions that initialize
btree blocks and btree buffers. The bulk of this work is to replace
btree geometry related function call arguments with a single pointer to
the ops structure, and then clean up everything else around that. As a
side effect, we rename the functions.

If you're going to start using this code, I strongly recommend pulling
from my git trees, which are linked below.

This has been running on the djcloud for months with no problems. Enjoy!
Comments and questions are, as always, welcome.

--D

kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=btree-geometry-in-ops

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=btree-geometry-in-ops
---
fs/xfs/libxfs/xfs_ag.c | 33 +++++++----------
fs/xfs/libxfs/xfs_ag.h | 2 +
fs/xfs/libxfs/xfs_alloc_btree.c | 21 ++++-------
fs/xfs/libxfs/xfs_bmap.c | 9 +----
fs/xfs/libxfs/xfs_bmap_btree.c | 14 ++-----
fs/xfs/libxfs/xfs_btree.c | 70 +++++++++++++++++++-----------------
fs/xfs/libxfs/xfs_btree.h | 36 ++++++++-----------
fs/xfs/libxfs/xfs_btree_mem.h | 9 -----
fs/xfs/libxfs/xfs_btree_staging.c | 6 +--
fs/xfs/libxfs/xfs_ialloc_btree.c | 17 ++++-----
fs/xfs/libxfs/xfs_refcount_btree.c | 8 ++--
fs/xfs/libxfs/xfs_rmap_btree.c | 16 ++++----
fs/xfs/libxfs/xfs_shared.h | 9 +++++
fs/xfs/scrub/trace.h | 10 ++---
fs/xfs/scrub/xfbtree.c | 16 +++-----
15 files changed, 118 insertions(+), 158 deletions(-)