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 effectively allows 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 mess, you probably ought to just pull from my git trees, which are linked below. This is an extraordinary way to destroy everything. 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 --- fs/xfs/libxfs/xfs_ag.c | 4 - fs/xfs/libxfs/xfs_ag_resv.c | 25 ++---- fs/xfs/libxfs/xfs_ag_resv.h | 2 fs/xfs/libxfs/xfs_errortag.h | 4 + fs/xfs/libxfs/xfs_imeta.c | 187 ++++++++++++++++++++++++++++++++++++++++++ fs/xfs/libxfs/xfs_imeta.h | 11 ++ fs/xfs/libxfs/xfs_types.h | 7 ++ fs/xfs/scrub/newbt.c | 3 - fs/xfs/scrub/repair.c | 5 - fs/xfs/xfs_error.c | 3 + fs/xfs/xfs_fsops.c | 39 +++++---- fs/xfs/xfs_fsops.h | 2 fs/xfs/xfs_inode.h | 3 + fs/xfs/xfs_mount.c | 10 ++ fs/xfs/xfs_mount.h | 1 fs/xfs/xfs_rtalloc.c | 23 +++++ fs/xfs/xfs_rtalloc.h | 5 + fs/xfs/xfs_super.c | 6 - fs/xfs/xfs_trace.h | 46 ++++++++++ 19 files changed, 335 insertions(+), 51 deletions(-)