[PATCHSET v5.0 2/9] xfs: create a generic allocation group structure

Darrick J. Wong
2024-10-11T00:33:47Z

Hi all,

Soon we'll be sharding the realtime volume into separate allocation
groups. These rt groups will /mostly/ behave the same as the ones on
the data device, but since rt groups don't have quite the same set of
struct fields as perags, let's hoist the parts that will be shared by
both into a common xfs_group object.

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=generic-groups

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=generic-groups
---
Commits in this patchset:
* xfs: factor out a xfs_iwalk_args helper
* xfs: factor out a generic xfs_group structure
* xfs: add a xfs_group_next_range helper
* xfs: switch perag iteration from the for_each macros to a while based iterator
* xfs: move metadata health tracking to the generic group structure
* xfs: mark xfs_perag_intent_{hold,rele} static
* xfs: move draining of deferred operations to the generic group structure
* xfs: move the online repair rmap hooks to the generic group structure
* xfs: return the busy generation from xfs_extent_busy_list_empty
* xfs: convert extent busy tracking to the generic group structure
* xfs: convert busy extent tracking to the generic group structure
* xfs: add a generic group pointer to the btree cursor
* xfs: store a generic xfs_group pointer in xfs_getfsmap_info
* xfs: add group based bno conversion helpers
* xfs: remove xfs_group_intent_hold and xfs_group_intent_rele
* xfs: store a generic group structure in the intents
---
fs/xfs/Makefile | 1
fs/xfs/libxfs/xfs_ag.c | 149 ++++-----------------
fs/xfs/libxfs/xfs_ag.h | 160 ++++++++++++-----------
fs/xfs/libxfs/xfs_ag_resv.c | 19 +--
fs/xfs/libxfs/xfs_alloc.c | 74 ++++++-----
fs/xfs/libxfs/xfs_alloc.h | 2
fs/xfs/libxfs/xfs_alloc_btree.c | 30 ++--
fs/xfs/libxfs/xfs_bmap.c | 2
fs/xfs/libxfs/xfs_bmap.h | 2
fs/xfs/libxfs/xfs_btree.c | 37 ++---
fs/xfs/libxfs/xfs_btree.h | 3
fs/xfs/libxfs/xfs_btree_mem.c | 6 -
fs/xfs/libxfs/xfs_group.c | 251 ++++++++++++++++++++++++++++++++++++
fs/xfs/libxfs/xfs_group.h | 82 ++++++++++++
fs/xfs/libxfs/xfs_health.h | 45 ++----
fs/xfs/libxfs/xfs_ialloc.c | 50 ++++---
fs/xfs/libxfs/xfs_ialloc_btree.c | 27 ++--
fs/xfs/libxfs/xfs_refcount.c | 26 ++--
fs/xfs/libxfs/xfs_refcount.h | 2
fs/xfs/libxfs/xfs_refcount_btree.c | 14 +-
fs/xfs/libxfs/xfs_rmap.c | 42 +++---
fs/xfs/libxfs/xfs_rmap.h | 6 -
fs/xfs/libxfs/xfs_rmap_btree.c | 28 ++--
fs/xfs/libxfs/xfs_sb.c | 21 +--
fs/xfs/libxfs/xfs_types.c | 5 -
fs/xfs/libxfs/xfs_types.h | 8 +
fs/xfs/scrub/agheader_repair.c | 22 ++-
fs/xfs/scrub/alloc.c | 2
fs/xfs/scrub/alloc_repair.c | 12 +-
fs/xfs/scrub/bmap.c | 8 +
fs/xfs/scrub/bmap_repair.c | 9 +
fs/xfs/scrub/common.c | 4 -
fs/xfs/scrub/common.h | 3
fs/xfs/scrub/cow_repair.c | 9 +
fs/xfs/scrub/fscounters.c | 10 +
fs/xfs/scrub/health.c | 21 +--
fs/xfs/scrub/ialloc.c | 14 +-
fs/xfs/scrub/ialloc_repair.c | 2
fs/xfs/scrub/inode_repair.c | 5 -
fs/xfs/scrub/iscan.c | 4 -
fs/xfs/scrub/newbt.c | 8 +
fs/xfs/scrub/reap.c | 2
fs/xfs/scrub/refcount.c | 3
fs/xfs/scrub/repair.c | 4 -
fs/xfs/scrub/rmap.c | 4 -
fs/xfs/scrub/rmap_repair.c | 16 +-
fs/xfs/scrub/trace.h | 82 ++++++------
fs/xfs/xfs_bmap_item.c | 5 -
fs/xfs/xfs_discard.c | 20 ++-
fs/xfs/xfs_drain.c | 78 +++++------
fs/xfs/xfs_drain.h | 22 +--
fs/xfs/xfs_extent_busy.c | 201 +++++++++++++++++------------
fs/xfs/xfs_extent_busy.h | 59 +++-----
fs/xfs/xfs_extfree_item.c | 14 +-
fs/xfs/xfs_filestream.c | 8 +
fs/xfs/xfs_fsmap.c | 49 ++++---
fs/xfs/xfs_fsops.c | 10 +
fs/xfs/xfs_health.c | 99 +++++++-------
fs/xfs/xfs_icache.c | 60 +++------
fs/xfs/xfs_inode.c | 6 -
fs/xfs/xfs_iwalk.c | 99 ++++++--------
fs/xfs/xfs_iwalk.h | 7 -
fs/xfs/xfs_log_recover.c | 11 +-
fs/xfs/xfs_mount.h | 6 +
fs/xfs/xfs_refcount_item.c | 9 +
fs/xfs/xfs_reflink.c | 7 -
fs/xfs/xfs_rmap_item.c | 9 +
fs/xfs/xfs_super.c | 11 +-
fs/xfs/xfs_trace.c | 1
fs/xfs/xfs_trace.h | 238 +++++++++++++++++++++-------------
70 files changed, 1315 insertions(+), 1050 deletions(-)
create mode 100644 fs/xfs/libxfs/xfs_group.c
create mode 100644 fs/xfs/libxfs/xfs_group.h