Hi all, XFS stores quota records and free space bitmap information in files. Add the necessary infrastructure to enable repairing metadata inodes and their forks, and then make it so that we can repair the file metadata for the rtbitmap. Repairing the bitmap contents (and the summary file) is left for subsequent patchsets. We also add the ability to repair file metadata the quota files. As part of these repairs, we also reinitialize the ondisk dquot records as necessary to get the incore dquots working. We can also correct obviously bad dquot record attributes, but we leave checking the resource usage counts for the next patchsets. 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=repair-quota xfsprogs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=repair-quota fstests git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=repair-quota --- fs/xfs/Makefile | 8 + fs/xfs/libxfs/xfs_bmap.c | 39 ++++ fs/xfs/libxfs/xfs_bmap.h | 2 fs/xfs/scrub/bmap_repair.c | 17 +- fs/xfs/scrub/quota.c | 11 + fs/xfs/scrub/quota.h | 11 + fs/xfs/scrub/quota_repair.c | 405 ++++++++++++++++++++++++++++++++++++++++ fs/xfs/scrub/repair.c | 151 +++++++++++++++ fs/xfs/scrub/repair.h | 22 ++ fs/xfs/scrub/rtbitmap.c | 10 + fs/xfs/scrub/rtbitmap_repair.c | 56 ++++++ fs/xfs/scrub/scrub.c | 8 - fs/xfs/scrub/trace.c | 1 fs/xfs/scrub/trace.h | 28 +++ fs/xfs/xfs_inode.c | 24 -- 15 files changed, 761 insertions(+), 32 deletions(-) create mode 100644 fs/xfs/scrub/quota.h create mode 100644 fs/xfs/scrub/quota_repair.c create mode 100644 fs/xfs/scrub/rtbitmap_repair.c