diff mbox series

[05/21] bcachefs: eytzinger self tests: eytzinger0_for_each loop cleanups

Message ID 20250128163859.1883260-6-agruenba@redhat.com (mailing list archive)
State New
Headers show
Series bcachefs: eytzinger code | expand

Commit Message

Andreas Gruenbacher Jan. 28, 2025, 4:38 p.m. UTC
The iterator variable of eytzinger0_for_each loops has been changed to
be locally scoped at some point, so remove variables defined outside the
loop that are now unused.  In addition and for clarity, use a different
variable inside those loops where an outside variable would be shadowed.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/bcachefs/util.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/fs/bcachefs/util.c b/fs/bcachefs/util.c
index 9a63d971ee65..58a7b962847d 100644
--- a/fs/bcachefs/util.c
+++ b/fs/bcachefs/util.c
@@ -473,10 +473,10 @@  void bch2_time_stats_to_text(struct printbuf *out, struct bch2_time_stats *stats
 		u64 last_q = 0;
 
 		prt_printf(out, "quantiles (%s):\t", u->name);
-		eytzinger0_for_each(i, NR_QUANTILES) {
-			bool is_last = eytzinger0_next(i, NR_QUANTILES) == -1;
+		eytzinger0_for_each(j, NR_QUANTILES) {
+			bool is_last = eytzinger0_next(j, NR_QUANTILES) == -1;
 
-			u64 q = max(quantiles->entries[i].m, last_q);
+			u64 q = max(quantiles->entries[j].m, last_q);
 			prt_printf(out, "%llu ", div64_u64(q, u->nsecs));
 			if (is_last)
 				prt_newline(out);
@@ -701,7 +701,7 @@  void memcpy_from_bio(void *dst, struct bio *src, struct bvec_iter src_iter)
 #if 1
 void eytzinger1_test(void)
 {
-	unsigned inorder, eytz, size;
+	unsigned inorder, size;
 
 	pr_info("1 based eytzinger test:");
 
@@ -734,7 +734,7 @@  void eytzinger1_test(void)
 void eytzinger0_test(void)
 {
 
-	unsigned inorder, eytz, size;
+	unsigned inorder, size;
 
 	pr_info("0 based eytzinger test:");
 
@@ -764,7 +764,7 @@  void eytzinger0_test(void)
 	}
 }
 
-static inline int cmp_u16(const void *_l, const void *_r, size_t size)
+static inline int cmp_u16(const void *_l, const void *_r)
 {
 	const u16 *l = _l, *r = _r;
 
@@ -787,8 +787,8 @@  static void eytzinger0_find_test_val(u16 *test_array, unsigned nr, u16 search)
 			c2 = test_array[i];
 
 	if (c1 != c2) {
-		eytzinger0_for_each(i, nr)
-			pr_info("[%3u] = %12u", i, test_array[i]);
+		eytzinger0_for_each(j, nr)
+			pr_info("[%3u] = %12u", j, test_array[j]);
 		pr_info("find_le(%2u) -> [%2zi] = %2i should be %2i",
 			i, r, c1, c2);
 	}
@@ -806,9 +806,9 @@  void eytzinger0_find_test(void)
 		eytzinger0_sort(test_array, nr, sizeof(test_array[0]), cmp_u16, NULL);
 
 		/* verify array is sorted correctly: */
-		eytzinger0_for_each(i, nr)
-			BUG_ON(i != eytzinger0_last(nr) &&
-			       test_array[i] > test_array[eytzinger0_next(i, nr)]);
+		eytzinger0_for_each(j, nr)
+			BUG_ON(j != eytzinger0_last(nr) &&
+			       test_array[j] > test_array[eytzinger0_next(j, nr)]);
 
 		for (i = 0; i < U16_MAX; i += 1 << 12)
 			eytzinger0_find_test_val(test_array, nr, i);