Hi all, This patchset enables use of the file data block sharing feature (i.e. reflink) on the realtime device. It follows the same basic sequence as the realtime rmap series -- first a few cleanups; then widening of the API parameters; and introduction of the new btree format and inode fork format. Next comes enabling CoW and remapping for the rt device; new scrub, repair, and health reporting code; and at the end we implement some code to lengthen write requests so that rt extents are always CoWed fully. 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-reflink xfsprogs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=realtime-reflink fstests git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=realtime-reflink xfsdocs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-documentation.git/log/?h=realtime-reflink --- fs/xfs/Makefile | 3 fs/xfs/libxfs/xfs_ag_resv.c | 5 fs/xfs/libxfs/xfs_bmap.c | 10 fs/xfs/libxfs/xfs_btree.c | 8 fs/xfs/libxfs/xfs_btree.h | 14 - fs/xfs/libxfs/xfs_format.h | 53 ++- fs/xfs/libxfs/xfs_fs.h | 4 fs/xfs/libxfs/xfs_health.h | 4 fs/xfs/libxfs/xfs_imeta.c | 2 fs/xfs/libxfs/xfs_imeta.h | 1 fs/xfs/libxfs/xfs_inode_buf.c | 20 + fs/xfs/libxfs/xfs_inode_fork.c | 13 + fs/xfs/libxfs/xfs_log_format.h | 5 fs/xfs/libxfs/xfs_refcount.c | 693 ++++++++++++++++++++------------- fs/xfs/libxfs/xfs_refcount.h | 34 +- fs/xfs/libxfs/xfs_rmap.c | 4 fs/xfs/libxfs/xfs_rtrefcount_btree.c | 704 ++++++++++++++++++++++++++++++++++ fs/xfs/libxfs/xfs_rtrefcount_btree.h | 184 +++++++++ fs/xfs/libxfs/xfs_rtrmap_btree.c | 44 ++ fs/xfs/libxfs/xfs_sb.c | 8 fs/xfs/libxfs/xfs_shared.h | 1 fs/xfs/libxfs/xfs_trans_resv.c | 25 + fs/xfs/libxfs/xfs_types.h | 5 fs/xfs/scrub/bmap.c | 12 + fs/xfs/scrub/bmap_repair.c | 3 fs/xfs/scrub/common.c | 8 fs/xfs/scrub/common.h | 6 fs/xfs/scrub/health.c | 1 fs/xfs/scrub/inode.c | 6 fs/xfs/scrub/inode_repair.c | 6 fs/xfs/scrub/repair.c | 20 + fs/xfs/scrub/repair.h | 5 fs/xfs/scrub/rmap.c | 4 fs/xfs/scrub/rmap_repair.c | 23 + fs/xfs/scrub/rtbitmap.c | 1 fs/xfs/scrub/rtbitmap_repair.c | 13 + fs/xfs/scrub/rtrefcount.c | 574 ++++++++++++++++++++++++++++ fs/xfs/scrub/rtrefcount_repair.c | 706 ++++++++++++++++++++++++++++++++++ fs/xfs/scrub/rtrmap.c | 52 ++- fs/xfs/scrub/rtrmap_repair.c | 3 fs/xfs/scrub/scrub.c | 7 fs/xfs/scrub/scrub.h | 13 + fs/xfs/scrub/trace.h | 27 + fs/xfs/xfs_bmap_util.c | 60 ++- fs/xfs/xfs_buf_item_recover.c | 4 fs/xfs/xfs_fsmap.c | 16 - fs/xfs/xfs_health.c | 4 fs/xfs/xfs_inode.c | 7 fs/xfs/xfs_inode_item.c | 2 fs/xfs/xfs_inode_item_recover.c | 5 fs/xfs/xfs_ioctl.c | 15 - fs/xfs/xfs_mount.c | 2 fs/xfs/xfs_mount.h | 4 fs/xfs/xfs_ondisk.h | 3 fs/xfs/xfs_refcount_item.c | 48 ++ fs/xfs/xfs_reflink.c | 163 +++++--- fs/xfs/xfs_reflink.h | 3 fs/xfs/xfs_rtalloc.c | 33 ++ fs/xfs/xfs_rtalloc.h | 4 fs/xfs/xfs_super.c | 5 fs/xfs/xfs_trace.h | 107 +++-- 61 files changed, 3308 insertions(+), 511 deletions(-) create mode 100644 fs/xfs/libxfs/xfs_rtrefcount_btree.c create mode 100644 fs/xfs/libxfs/xfs_rtrefcount_btree.h create mode 100644 fs/xfs/scrub/rtrefcount.c create mode 100644 fs/xfs/scrub/rtrefcount_repair.c