Hi all, Add libxfs code from the kernel, then teach the various utilities about how to access realtime rmapbt information and rebuild it. 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=realtime-rmap xfsprogs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=realtime-rmap fstests git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=realtime-rmap xfsdocs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-documentation.git/log/?h=realtime-rmap --- db/bmroot.c | 149 ++++++ db/bmroot.h | 2 db/btblock.c | 103 ++++ db/btblock.h | 5 db/btdump.c | 64 +++ db/btheight.c | 5 db/check.c | 203 +++++++++ db/field.c | 11 db/field.h | 5 db/fsmap.c | 135 ++++++ db/inode.c | 113 +++++ db/inode.h | 4 db/metadump.c | 125 +++++ db/type.c | 5 db/type.h | 1 include/libxfs.h | 2 include/xfs_mount.h | 14 + libfrog/scrub.c | 5 libxfs/Makefile | 2 libxfs/defer_item.c | 28 + libxfs/init.c | 20 - libxfs/libxfs_api_defs.h | 19 + libxfs/rdwr.c | 2 libxfs/trans.c | 1 libxfs/xfbtree.c | 2 libxfs/xfs_bmap.c | 22 + libxfs/xfs_btree.c | 120 +++++ libxfs/xfs_btree.h | 7 libxfs/xfs_defer.c | 1 libxfs/xfs_defer.h | 1 libxfs/xfs_format.h | 24 + libxfs/xfs_fs.h | 4 libxfs/xfs_health.h | 4 libxfs/xfs_imeta.c | 6 libxfs/xfs_inode_buf.c | 6 libxfs/xfs_inode_fork.c | 13 + libxfs/xfs_log_format.h | 4 libxfs/xfs_refcount.c | 6 libxfs/xfs_rmap.c | 227 ++++++++-- libxfs/xfs_rmap.h | 22 + libxfs/xfs_rtgroup.c | 12 + libxfs/xfs_rtgroup.h | 20 + libxfs/xfs_rtrmap_btree.c | 1033 +++++++++++++++++++++++++++++++++++++++++++++ libxfs/xfs_rtrmap_btree.h | 218 +++++++++ libxfs/xfs_sb.c | 6 libxfs/xfs_shared.h | 2 libxfs/xfs_swapext.c | 4 libxfs/xfs_trans_resv.c | 12 - libxfs/xfs_trans_space.h | 13 + libxfs/xfs_types.h | 5 man/man8/xfs_db.8 | 63 +++ mkfs/proto.c | 62 +++ mkfs/xfs_mkfs.c | 90 ++++ repair/Makefile | 1 repair/agbtree.c | 5 repair/bmap_repair.c | 122 +++++ repair/dino_chunks.c | 13 + repair/dinode.c | 373 ++++++++++++++-- repair/dir2.c | 4 repair/incore.h | 1 repair/phase2.c | 92 ++++ repair/phase4.c | 12 + repair/phase6.c | 178 ++++++++ repair/rmap.c | 482 +++++++++++++++++---- repair/rmap.h | 15 - repair/rtrmap_repair.c | 253 +++++++++++ repair/scan.c | 411 +++++++++++++++++- repair/scan.h | 37 ++ repair/xfs_repair.c | 8 scrub/phase4.c | 43 ++ scrub/repair.c | 124 +++++ scrub/repair.h | 5 spaceman/health.c | 10 73 files changed, 4949 insertions(+), 272 deletions(-) create mode 100644 libxfs/xfs_rtrmap_btree.c create mode 100644 libxfs/xfs_rtrmap_btree.h create mode 100644 repair/rtrmap_repair.c