summaryrefslogtreecommitdiff
tag namescrub-detect-mergeable-records_2022-11-09 (6d27cc15a9eacbb729c41a5ca15a9528d8c4c9d2)
tag date2022-11-09 19:09:48 -0800
tagged byDarrick J. Wong <djwong@kernel.org>
tagged objectcommit 32490581e3...
xfs: detect mergeable and overlapping btree records
While I was doing differential fuzz analysis between xfs_scrub and xfs_repair, I noticed that xfs_repair was only partially effective at detecting btree records that can be merged, and xfs_scrub totally didn't notice at all. For every interval btree type except for the bmbt, there should never exist two adjacent records with adjacent keyspaces because the blockcount field is always large enough to span the entire keyspace of the domain. This is because the free space, rmap, and refcount btrees have a blockcount field large enough to store the maximum AG length, and there can never be an allocation larger than an AG. The bmbt is a different story due to its ondisk encoding where the blockcount is only 21 bits wide. Because AGs can span up to 2^31 blocks and the RT volume can span up to 2^52 blocks, a preallocation of 2^22 blocks will be expressed as two records of 2^21 length. We don't opportunistically combine records when doing bmbt operations, which is why the fsck tools have never complained about this scenario. Offline repair is partially effective at detecting mergeable records because I taught it to do that for the rmap and refcount btrees. This series enhances the free space, rmap, and refcount scrubbers to detect mergeable records. For the bmbt, it will flag the file as being eligible for an optimization to shrink the size of the data structure. The last patch in this set also enhances the rmap scrubber to detect records that overlap incorrectly. This check is done automatically for non-overlapping btree types, but we have to do it separately for the rmapbt because there are constraints on which allocation types are allowed to overlap. Signed-off-by: Darrick J. Wong <djwong@kernel.org> -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEUzaAxoMeQq6m2jMV+H93GTRKtOsFAmNsa3wACgkQ+H93GTRK tOtWuQ/8DDJN/DZvKaMPpHvzQJhH7m2jJNC8wcmef24Xbiu5ObbGY5jX4reVwyNh 3xKlzdIaRQRUi9UH04aaqiLVVKiTIwz4xjf8hQdksZoWHl0B4b4OQmT3ps6EYjYw p69LOdovtjJvjexFhC2Uc6fMvmm4aXwLD/EdeNTiEh3gnoQ0E2iirDtts3aKn7nc FEmDHsOq7WduVrqWYydWYpN4EucIFX8nLB51j71Li1NqnpzQg4Hq3XBvqgkGjJIi lnUm5pnPh8/0Ow+Llij5LcwL6X4L5OLbA3rcRh4UVXg4/qKGg4DTvPK23MpuzuVm io+hgwP4VUzFG8Db59P4EYhTtRE3MPv9yuToXRZhhCxSsHbFdY8SIM/mmDQkxRWm utECN4PfiP6E+im0T80rKlrQqYY4dKCeBJMjVbrAWwBmBvTI2G91gGQCizG13CB/ mI+6fI+XZFFlvHQ9rFVggwGFYH9s87dgqspXsiniki7eYV/fXAE4GFHllmf33lbi LpVstV3AUMu0/WqbtsZW7eBsrx7jDQjlOUp8a3P0ns8Tb3B1u+thIBeUuSfv/BZ7 LkwwWYxectuK26SrbAMnANEj620Dd3GzP32T/dlkxe8VUeqB9/2aFBPfk5YEE/0f U9kirz7StNUzVusmhoj8Y0xxW0398m0+95KEM6iLAZmQKeZeb3k= =/efC -----END PGP SIGNATURE-----