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 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=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 --- db/bmroot.c | 148 ++++++ db/bmroot.h | 2 db/btblock.c | 53 ++ db/btblock.h | 5 db/btdump.c | 11 db/btheight.c | 5 db/check.c | 326 ++++++++++++- db/field.c | 15 + db/field.h | 6 db/inode.c | 91 ++++ db/inode.h | 2 db/metadump.c | 129 +++++ db/type.c | 5 db/type.h | 1 include/libxfs.h | 1 include/xfs_mount.h | 9 libfrog/scrub.c | 10 libxfs/Makefile | 2 libxfs/defer_item.c | 101 ++++ libxfs/init.c | 14 - libxfs/libxfs_api_defs.h | 13 + libxfs/logitem.c | 14 + libxfs/xfs_bmap.c | 31 + libxfs/xfs_btree.c | 5 libxfs/xfs_btree.h | 12 libxfs/xfs_defer.h | 1 libxfs/xfs_format.h | 25 + libxfs/xfs_fs.h | 6 libxfs/xfs_fs_staging.h | 1 libxfs/xfs_health.h | 4 libxfs/xfs_inode_buf.c | 36 + libxfs/xfs_inode_fork.c | 13 + libxfs/xfs_log_format.h | 6 libxfs/xfs_ondisk.h | 2 libxfs/xfs_refcount.c | 341 ++++++++++++-- libxfs/xfs_refcount.h | 29 + libxfs/xfs_rmap.c | 14 + libxfs/xfs_rtgroup.c | 10 libxfs/xfs_rtgroup.h | 8 libxfs/xfs_rtrefcount_btree.c | 803 +++++++++++++++++++++++++++++++++ libxfs/xfs_rtrefcount_btree.h | 196 ++++++++ libxfs/xfs_rtrmap_btree.c | 28 + libxfs/xfs_sb.c | 8 libxfs/xfs_shared.h | 2 libxfs/xfs_trans_resv.c | 25 + libxfs/xfs_types.h | 5 logprint/log_misc.c | 2 logprint/log_print_all.c | 8 logprint/log_redo.c | 24 + man/man2/ioctl_xfs_rtgroup_geometry.2 | 3 man/man2/ioctl_xfs_scrub_metadata.2 | 9 man/man8/xfs_db.8 | 49 ++ mkfs/proto.c | 36 + mkfs/xfs_mkfs.c | 79 +++ repair/Makefile | 1 repair/agbtree.c | 4 repair/dino_chunks.c | 11 repair/dinode.c | 267 ++++++++++- repair/dir2.c | 2 repair/incore.h | 1 repair/phase2.c | 83 +++ repair/phase4.c | 30 + repair/phase5.c | 3 repair/phase6.c | 133 +++++ repair/rmap.c | 353 ++++++++++++--- repair/rmap.h | 19 + repair/rtrefcount_repair.c | 256 +++++++++++ repair/scan.c | 324 +++++++++++++ repair/scan.h | 33 + scrub/repair.c | 1 spaceman/health.c | 10 71 files changed, 4041 insertions(+), 274 deletions(-) create mode 100644 libxfs/xfs_rtrefcount_btree.c create mode 100644 libxfs/xfs_rtrefcount_btree.h create mode 100644 repair/rtrefcount_repair.c