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 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 --- 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 | 191 ++++++++++++++++++++++++++++++++++++++++++ fs/xfs/libxfs/xfs_imeta.h | 11 ++ fs/xfs/libxfs/xfs_types.h | 7 ++ 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 ++++++++++ 18 files changed, 337 insertions(+), 50 deletions(-)