Hi all, Add libxfs code from the kernel, then teach xfs_repair and mkfs to use the metadir functions to find metadata inodes. 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=metadir xfsprogs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=metadir fstests git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=metadir xfsdocs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-documentation.git/log/?h=metadir --- db/check.c | 21 + db/inode.c | 3 db/metadump.c | 92 ++- db/namei.c | 43 + db/sb.c | 43 + include/kmem.h | 4 include/libxfs.h | 1 include/xfs_inode.h | 13 include/xfs_mount.h | 3 include/xfs_trace.h | 13 io/bulkstat.c | 16 - libfrog/fsgeom.c | 4 libxfs/Makefile | 2 libxfs/init.c | 40 + libxfs/inode.c | 130 ++++ libxfs/libxfs_api_defs.h | 20 + libxfs/libxfs_priv.h | 4 libxfs/util.c | 75 ++ libxfs/xfs_format.h | 51 ++ libxfs/xfs_fs.h | 12 libxfs/xfs_health.h | 4 libxfs/xfs_ialloc.c | 16 - libxfs/xfs_ialloc.h | 2 libxfs/xfs_imeta.c | 1209 +++++++++++++++++++++++++++++++++++++++ libxfs/xfs_imeta.h | 94 +++ libxfs/xfs_inode_buf.c | 73 ++ libxfs/xfs_inode_buf.h | 3 libxfs/xfs_inode_util.c | 4 libxfs/xfs_log_rlimit.c | 9 libxfs/xfs_sb.c | 35 + libxfs/xfs_trans_resv.c | 74 ++ libxfs/xfs_trans_resv.h | 2 libxfs/xfs_types.c | 7 man/man2/ioctl_xfs_fsgeometry.2 | 3 man/man8/mkfs.xfs.8.in | 11 man/man8/xfs_admin.8 | 9 man/man8/xfs_db.8 | 11 man/man8/xfs_io.8 | 10 man/man8/xfs_protofile.8 | 33 + mkfs/Makefile | 10 mkfs/lts_4.19.conf | 1 mkfs/lts_5.10.conf | 1 mkfs/lts_5.15.conf | 1 mkfs/proto.c | 283 +++++++-- mkfs/xfs_mkfs.c | 26 + mkfs/xfs_protofile.in | 152 +++++ repair/agheader.c | 7 repair/dino_chunks.c | 58 ++ repair/dinode.c | 173 +++++- repair/dinode.h | 6 repair/dir2.c | 77 ++ repair/globals.c | 4 repair/globals.h | 4 repair/incore.h | 50 +- repair/incore_ino.c | 1 repair/phase1.c | 2 repair/phase2.c | 76 ++ repair/phase4.c | 21 + repair/phase5.c | 7 repair/phase6.c | 853 +++++++++++++++++++++++----- repair/protos.h | 6 repair/sb.c | 3 repair/scan.c | 43 + repair/scan.h | 7 repair/xfs_repair.c | 88 +++ scrub/inodes.c | 5 scrub/inodes.h | 5 scrub/phase3.c | 7 scrub/phase5.c | 2 scrub/phase6.c | 2 70 files changed, 3785 insertions(+), 395 deletions(-) create mode 100644 libxfs/xfs_imeta.c create mode 100644 libxfs/xfs_imeta.h create mode 100644 man/man8/xfs_protofile.8 create mode 100644 mkfs/xfs_protofile.in