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 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=repair-file-mappings-6.8 --- fs/xfs/Makefile | 2 fs/xfs/libxfs/xfs_bmap_btree.c | 121 ++++- 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/bmap.c | 18 + fs/xfs/scrub/bmap_repair.c | 858 +++++++++++++++++++++++++++++++++++++ fs/xfs/scrub/common.h | 6 fs/xfs/scrub/cow_repair.c | 614 ++++++++++++++++++++++++++ fs/xfs/scrub/fsb_bitmap.h | 37 ++ fs/xfs/scrub/off_bitmap.h | 37 ++ fs/xfs/scrub/reap.c | 153 ++++++- fs/xfs/scrub/reap.h | 5 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 | 62 +++ fs/xfs/xfs_trans.h | 4 24 files changed, 2160 insertions(+), 52 deletions(-) create mode 100644 fs/xfs/scrub/bmap_repair.c create mode 100644 fs/xfs/scrub/cow_repair.c create mode 100644 fs/xfs/scrub/fsb_bitmap.h create mode 100644 fs/xfs/scrub/off_bitmap.h