[PATCHSET v4.0 07/10] xfs: create incore rt allocation groups

Darrick J. Wong
2024-08-22T23:57:59Z

Hi all,

This series adds in-memory data structures for sharding the realtime volume
into independent allocation groups. For existing filesystems, the entire rt
volume is modelled as having a single large group, with (potentially) a number
of rt extents exceeding 2^32, though these are not likely to exist because the
codebase has been a bit broken for decades. The next series fills in the
ondisk format and other supporting structures.

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=incore-rtgroups

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=incore-rtgroups
---
Commits in this patchset:
* xfs: clean up the ISVALID macro in xfs_bmap_adjacent
* xfs: factor out a xfs_rtallocate helper
* xfs: rework the rtalloc fallback handling
* xfs: factor out a xfs_rtallocate_align helper
* xfs: make the rtalloc start hint a xfs_rtblock_t
* xfs: add xchk_setup_nothing and xchk_nothing helpers
* xfs: remove xfs_{rtbitmap,rtsummary}_wordcount
* xfs: replace m_rsumsize with m_rsumblocks
* xfs: rearrange xfs_fsmap.c a little bit
* xfs: move xfs_ioc_getfsmap out of xfs_ioctl.c
* xfs: create incore realtime group structures
* xfs: define locking primitives for realtime groups
* xfs: add a lockdep class key for rtgroup inodes
* xfs: support caching rtgroup metadata inodes
* xfs: add rtgroup-based realtime scrubbing context management
* xfs: move RT bitmap and summary information to the rtgroup
* xfs: remove XFS_ILOCK_RT*
* xfs: calculate RT bitmap and summary blocks based on sb_rextents
* xfs: factor out a xfs_growfs_rt_alloc_fake_mount helper
* xfs: use xfs_growfs_rt_alloc_fake_mount in xfs_growfs_rt_alloc_blocks
* xfs: factor out a xfs_growfs_check_rtgeom helper
* xfs: refactor xfs_rtbitmap_blockcount
* xfs: refactor xfs_rtsummary_blockcount
* xfs: make RT extent numbers relative to the rtgroup
---
fs/xfs/Makefile | 1
fs/xfs/libxfs/xfs_bmap.c | 101 +++--
fs/xfs/libxfs/xfs_format.h | 3
fs/xfs/libxfs/xfs_rtbitmap.c | 222 +++++------
fs/xfs/libxfs/xfs_rtbitmap.h | 152 ++++----
fs/xfs/libxfs/xfs_rtgroup.c | 529 +++++++++++++++++++++++++++
fs/xfs/libxfs/xfs_rtgroup.h | 268 ++++++++++++++
fs/xfs/libxfs/xfs_sb.c | 7
fs/xfs/libxfs/xfs_trans_resv.c | 4
fs/xfs/libxfs/xfs_types.h | 4
fs/xfs/scrub/bmap.c | 13 +
fs/xfs/scrub/common.c | 78 ++++
fs/xfs/scrub/common.h | 59 ++-
fs/xfs/scrub/fscounters.c | 26 +
fs/xfs/scrub/repair.c | 24 +
fs/xfs/scrub/repair.h | 7
fs/xfs/scrub/rtbitmap.c | 54 ++-
fs/xfs/scrub/rtsummary.c | 118 +++---
fs/xfs/scrub/rtsummary.h | 2
fs/xfs/scrub/rtsummary_repair.c | 19 -
fs/xfs/scrub/scrub.c | 33 ++
fs/xfs/scrub/scrub.h | 42 +-
fs/xfs/xfs_discard.c | 100 +++--
fs/xfs/xfs_fsmap.c | 435 +++++++++++++++--------
fs/xfs/xfs_fsmap.h | 6
fs/xfs/xfs_inode.c | 3
fs/xfs/xfs_inode.h | 13 -
fs/xfs/xfs_ioctl.c | 130 -------
fs/xfs/xfs_iomap.c | 4
fs/xfs/xfs_log_recover.c | 20 +
fs/xfs/xfs_mount.c | 18 +
fs/xfs/xfs_mount.h | 29 +-
fs/xfs/xfs_qm.c | 27 +
fs/xfs/xfs_rtalloc.c | 753 ++++++++++++++++++++++++---------------
fs/xfs/xfs_super.c | 4
fs/xfs/xfs_trace.c | 1
fs/xfs/xfs_trace.h | 38 ++
37 files changed, 2326 insertions(+), 1021 deletions(-)
create mode 100644 fs/xfs/libxfs/xfs_rtgroup.c
create mode 100644 fs/xfs/libxfs/xfs_rtgroup.h