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 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=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 | 9 + fs/xfs/libxfs/xfs_format.h | 3 fs/xfs/scrub/dqiterate.c | 211 ++++++++++++++++ fs/xfs/scrub/quota.c | 107 +++++++- fs/xfs/scrub/quota.h | 36 +++ fs/xfs/scrub/quota_repair.c | 575 +++++++++++++++++++++++++++++++++++++++++++ fs/xfs/scrub/repair.h | 7 + fs/xfs/scrub/scrub.c | 6 fs/xfs/scrub/trace.c | 3 fs/xfs/scrub/trace.h | 78 ++++++ fs/xfs/xfs_dquot.c | 37 --- fs/xfs/xfs_dquot.h | 8 - 12 files changed, 1026 insertions(+), 54 deletions(-) create mode 100644 fs/xfs/scrub/dqiterate.c create mode 100644 fs/xfs/scrub/quota.h create mode 100644 fs/xfs/scrub/quota_repair.c