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 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 --- Commits in this patchset: * libxfs: compute the rt refcount btree maxlevels during initialization * libxfs: add a realtime flag to the refcount update log redo items * libxfs: apply rt extent alignment constraints to CoW extsize hint * libfrog: enable scrubbing of the realtime refcount data * man: document userspace API changes due to rt reflink * xfs_db: display the realtime refcount btree contents * xfs_db: support the realtime refcountbt * xfs_db: copy the realtime refcount btree * xfs_db: add rtrefcount reservations to the rgresv command * xfs_spaceman: report health of the realtime refcount btree * xfs_repair: allow CoW staging extents in the realtime rmap records * xfs_repair: use realtime refcount btree data to check block types * xfs_repair: find and mark the rtrefcountbt inode * xfs_repair: compute refcount data for the realtime groups * xfs_repair: check existing realtime refcountbt entries against observed refcounts * xfs_repair: reject unwritten shared extents * xfs_repair: rebuild the realtime refcount btree * xfs_repair: allow realtime files to have the reflink flag set * xfs_repair: validate CoW extent size hint on rtinherit directories * xfs_logprint: report realtime CUIs * mkfs: validate CoW extent size hint when rtinherit is set * mkfs: enable reflink on the realtime device --- db/bmroot.c | 148 +++++++++++++++ db/bmroot.h | 2 db/btblock.c | 53 ++++++ db/btblock.h | 5 + db/btdump.c | 8 + db/btheight.c | 5 + db/field.c | 15 ++ db/field.h | 6 + db/info.c | 13 + db/inode.c | 22 ++ db/metadump.c | 114 ++++++++++++ db/type.c | 5 + db/type.h | 1 libfrog/scrub.c | 10 + libxfs/defer_item.c | 34 +++- libxfs/init.c | 8 + libxfs/libxfs_api_defs.h | 14 + libxfs/logitem.c | 14 + logprint/log_misc.c | 2 logprint/log_print_all.c | 8 + logprint/log_redo.c | 24 ++ man/man2/ioctl_xfs_scrub_metadata.2 | 10 + man/man8/xfs_db.8 | 49 +++++ mkfs/xfs_mkfs.c | 83 ++++++++- repair/Makefile | 1 repair/agbtree.c | 4 repair/dino_chunks.c | 11 + repair/dinode.c | 287 +++++++++++++++++++++++++++--- repair/dir2.c | 5 + repair/incore.h | 1 repair/phase4.c | 34 +++- repair/phase5.c | 6 - repair/phase6.c | 14 + repair/rmap.c | 241 ++++++++++++++++++++----- repair/rmap.h | 15 +- repair/rt.h | 4 repair/rtrefcount_repair.c | 257 +++++++++++++++++++++++++++ repair/scan.c | 337 ++++++++++++++++++++++++++++++++++- repair/scan.h | 33 +++ scrub/repair.c | 1 spaceman/health.c | 10 + 41 files changed, 1792 insertions(+), 122 deletions(-) create mode 100644 repair/rtrefcount_repair.c