[PATCHSET v6.0 2/5] xfs: enable in-core block reservation for rt metadata

Darrick J. Wong
2024-12-13T00:57:12Z

Hi all,

In preparation for adding reverse mapping and refcounting to the
realtime device, enhance the metadir code to reserve free space for
btree shape changes as delayed allocation blocks.

This enables us to pre-allocate space for the rmap and refcount btrees
in the same manner as we do for the data device counterparts, which is
how we avoid ENOSPC failures when space is low but we've already
committed to a COW operation.

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=reserve-rt-metadata-space

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=reserve-rt-metadata-space
---
Commits in this patchset:
* xfs: prepare to reuse the dquot pointer space in struct xfs_inode
* xfs: allow inode-based btrees to reserve space in the data device
---
fs/xfs/libxfs/xfs_ag_resv.c | 3 +
fs/xfs/libxfs/xfs_attr.c | 4 -
fs/xfs/libxfs/xfs_bmap.c | 4 -
fs/xfs/libxfs/xfs_errortag.h | 4 +
fs/xfs/libxfs/xfs_metadir.c | 4 +
fs/xfs/libxfs/xfs_metafile.c | 205 ++++++++++++++++++++++++++++++++++++++++++
fs/xfs/libxfs/xfs_metafile.h | 11 ++
fs/xfs/libxfs/xfs_types.h | 7 +
fs/xfs/scrub/tempfile.c | 1
fs/xfs/xfs_dquot.h | 3 +
fs/xfs/xfs_error.c | 3 +
fs/xfs/xfs_exchrange.c | 3 +
fs/xfs/xfs_fsops.c | 17 +++
fs/xfs/xfs_inode.h | 16 +++
fs/xfs/xfs_mount.c | 10 ++
fs/xfs/xfs_mount.h | 1
fs/xfs/xfs_qm.c | 2
fs/xfs/xfs_quota.h | 5 -
fs/xfs/xfs_rtalloc.c | 21 ++++
fs/xfs/xfs_rtalloc.h | 5 +
fs/xfs/xfs_trace.h | 45 +++++++++
fs/xfs/xfs_trans.c | 4 +
fs/xfs/xfs_trans_dquot.c | 8 +-
23 files changed, 367 insertions(+), 19 deletions(-)