]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bcachefs: improve eytzinger0_find_le self test
authorAndreas Gruenbacher <agruenba@redhat.com>
Sun, 26 Jan 2025 16:57:06 +0000 (17:57 +0100)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 15 Mar 2025 01:02:13 +0000 (21:02 -0400)
commitc722b818a2f8c43d75efeba8005af5f17dc535f0
tree33b00ae5cfdc9c09cf7d5eb1f0ed71c9cfe7648e
parentdc5ceaaad81a724e7090d8709290fae36e3f2a5d
bcachefs: improve eytzinger0_find_le self test

Rename eytzinger0_find_test_val() to eytzinger0_find_test_le() and add a
new eytzinger0_find_test_val() wrapper that calls it.

We have already established that the array is sorted in eytzinger order,
so we can use the eytzinger iterator functions and check the boundary
conditions to verify the result of eytzinger0_find_le().

Only scan the entire array if we get an incorrect result.  When we need
to scan, use eytzinger0_for_each_prev() so that we'll stop at the
highest matching element in the array in case there are duplicates;
going through the array linearly wouldn't give us that.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/util.c