[PATCHSET v4.1] xfs: cleanups for inode rooted btree code

Darrick J. Wong
2024-08-27T23:33:53Z

Hi all,

This series prepares the btree code to support realtime reverse mapping btrees
by refactoring xfs_ifork_realloc to be fed a per-btree ops structure so that it
can handle multiple types of inode-rooted btrees. It moves on to refactoring
the btree code to use the new realloc routines.

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-cleanups

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=btree-cleanups
---
Commits in this patchset:
* xfs: fix C++ compilation errors in xfs_fs.h
* xfs: fix FITRIM reporting again
* xfs: fix a sloppy memory handling bug in xfs_iroot_realloc
* xfs: replace shouty XFS_BM{BT,DR} macros
* xfs: move the zero records logic into xfs_bmap_broot_space_calc
* xfs: refactor the allocation and freeing of incore inode fork btree roots
* xfs: refactor creation of bmap btree roots
* xfs: hoist the code that moves the incore inode fork broot memory
* xfs: rearrange xfs_iroot_realloc a bit
* xfs: standardize the btree maxrecs function parameters
---
fs/xfs/libxfs/xfs_alloc_btree.c | 6 +
fs/xfs/libxfs/xfs_alloc_btree.h | 3 -
fs/xfs/libxfs/xfs_attr_leaf.c | 8 +
fs/xfs/libxfs/xfs_bmap.c | 62 +++++-----
fs/xfs/libxfs/xfs_bmap_btree.c | 37 ++++--
fs/xfs/libxfs/xfs_bmap_btree.h | 216 +++++++++++++++++++++++++-----------
fs/xfs/libxfs/xfs_fs.h | 4 -
fs/xfs/libxfs/xfs_ialloc.c | 4 -
fs/xfs/libxfs/xfs_ialloc_btree.c | 6 +
fs/xfs/libxfs/xfs_ialloc_btree.h | 3 -
fs/xfs/libxfs/xfs_inode_fork.c | 192 ++++++++++++++++++--------------
fs/xfs/libxfs/xfs_inode_fork.h | 3 +
fs/xfs/libxfs/xfs_refcount_btree.c | 5 +
fs/xfs/libxfs/xfs_refcount_btree.h | 3 -
fs/xfs/libxfs/xfs_rmap_btree.c | 7 +
fs/xfs/libxfs/xfs_rmap_btree.h | 3 -
fs/xfs/libxfs/xfs_sb.c | 16 +--
fs/xfs/libxfs/xfs_trans_resv.c | 2
fs/xfs/scrub/bmap_repair.c | 2
fs/xfs/scrub/inode_repair.c | 12 +-
fs/xfs/xfs_bmap_util.c | 4 -
fs/xfs/xfs_discard.c | 2
22 files changed, 363 insertions(+), 237 deletions(-)