Hi all, In this series, online repair gains the ability to rebuild data and attr fork mappings from the reverse mapping information. It is at this point where we reintroduce the ability to reap file extents. Repair of CoW forks is a little different -- on disk, CoW staging extents are owned by the refcount btree and cannot be mapped back to individual files. Hence we can only detect staging extents that don't quite look right (missing reverse mappings, shared staging extents) and replace them with fresh allocations. 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=repair-file-mappings xfsprogs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=repair-file-mappings fstests git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=repair-file-mappings --- fs/xfs/Makefile | 2 fs/xfs/libxfs/xfs_bmap_btree.c | 112 +++++ fs/xfs/libxfs/xfs_bmap_btree.h | 5 fs/xfs/libxfs/xfs_btree_staging.c | 11 - fs/xfs/libxfs/xfs_btree_staging.h | 2 fs/xfs/libxfs/xfs_iext_tree.c | 23 + fs/xfs/libxfs/xfs_inode_fork.c | 1 fs/xfs/libxfs/xfs_inode_fork.h | 3 fs/xfs/libxfs/xfs_refcount.c | 41 ++ fs/xfs/libxfs/xfs_refcount.h | 10 fs/xfs/scrub/bitmap.h | 28 + fs/xfs/scrub/bmap.c | 18 + fs/xfs/scrub/bmap_repair.c | 776 +++++++++++++++++++++++++++++++++++++ fs/xfs/scrub/cow_repair.c | 609 +++++++++++++++++++++++++++++ fs/xfs/scrub/reap.c | 145 +++++++ fs/xfs/scrub/reap.h | 2 fs/xfs/scrub/repair.c | 50 ++ fs/xfs/scrub/repair.h | 11 + fs/xfs/scrub/scrub.c | 20 - fs/xfs/scrub/trace.h | 118 ++++++ fs/xfs/xfs_trans.c | 95 +++++ fs/xfs/xfs_trans.h | 4 22 files changed, 2041 insertions(+), 45 deletions(-) create mode 100644 fs/xfs/scrub/bmap_repair.c create mode 100644 fs/xfs/scrub/cow_repair.c