This patchset contains some improvements to the allocation btree checking
in xfs_repair. Patches 2 / 3 are straight ports of code used for xfs_check
in xfs_db and bring the level of btree-related checks up to the standard
of xfs_check, making xfs_repair -n a fully suitable replacement for xfs_check.
Patch 1 is a bug fixes found while validating the other patches.
With this code we could in theory start chaning xfs_check to use xfs_repair
as backend instead of xfs_db, but there are two issues still preventing this
- xfs_check is supposed to not give any output when a filesystem is clean
while xfs_repair is quite noisy
- xfs_check has a -s option to only complain about serious structural
issues while xfs_repair lacks the infrastructure for it.
- xfs_check has -i and -b options to only examine specific blocks or inodes
in details, while xfs_repair lacks the infrastructure for this.
While we could add support for this in xfs_repair I wonder if we should
just leave xfs_check as-is and instead tie up xfs_repair -n to fsck.xfs
if used with the -f option or the /forcefsck file. Most fsck programs
are a least a bit noisy to we would fit right in and there's not need
to implement the additional check options.
We can't really get rid of the check code in xfs_db anyway as it's also
used for xfs_ncheck and useful db commands like blockuse. A second codebase
also provides a useful validation for xfs_repair.