Merge tag 'scrub-detect-refcount-gaps-6.4_2023-04-11' of git://git.kernel.org/pub...
authorDave Chinner <david@fromorbit.com>
Thu, 13 Apr 2023 21:09:55 +0000 (07:09 +1000)
committerDave Chinner <dchinner@redhat.com>
Thu, 13 Apr 2023 21:09:55 +0000 (07:09 +1000)
commite7cef2fe444b18e246d95d2a9156b37506590d61
tree3aeebb90195d01a4b103e6f2a9f3752970a366e8
parent6858c88701077730fa99342fe3e066c68efc9df4
parent7ac14fa2bd22e99a06ae16382b394f697cfe2b8a
Merge tag 'scrub-detect-refcount-gaps-6.4_2023-04-11' of git://git./linux/kernel/git/djwong/xfs-linux into guilt/xfs-for-next

xfs: detect incorrect gaps in refcount btree [v24.5]

The next few patchsets address a deficiency in scrub that I found while
QAing the refcount btree scrubber.  If there's a gap between refcount
records, we need to cross-reference that gap with the reverse mappings
to ensure that there are no overlapping records in the rmap btree.  If
we find any, then the refcount btree is not consistent.  This is not a
property that is specific to the refcount btree; they all need to have
this sort of keyspace scanning logic to detect inconsistencies.

To do this accurately, we need to be able to scan the keyspace of a
btree (which we already do) to be able to tell the caller if the
keyspace is empty, sparse, or fully covered by records.  The first few
patches add the keyspace scanner to the generic btree code, along with
the ability to mask off parts of btree keys because when we scan the
rmapbt, we only care about space usage, not the owners.

The final patch closes the scanning gap in the refcountbt scanner.

v23.1: create helpers for the key extraction and comparison functions,
       improve documentation, and eliminate the ->mask_key indirect
       calls

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Dave Chinner <david@fromorbit.com>