diff options
| author | Andreas Gruenbacher <agruenba@redhat.com> | 2024-11-26 12:12:36 +0100 |
|---|---|---|
| committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-03-14 21:02:13 -0400 |
| commit | 217ad1d7c707e310f3f4b7eeb9b7ea48f4cf3821 (patch) | |
| tree | b5d5f5668ecd8a23d255976e5b1ee3b67c7a8964 /fs/bcachefs/util.c | |
| parent | bcachefs: EYTZINGER_DEBUG fix (diff) | |
| download | linux-217ad1d7c707e310f3f4b7eeb9b7ea48f4cf3821.tar.gz linux-217ad1d7c707e310f3f4b7eeb9b7ea48f4cf3821.zip | |
bcachefs: eytzinger self tests: loop cleanups
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>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/util.c')
| -rw-r--r-- | fs/bcachefs/util.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/bcachefs/util.c b/fs/bcachefs/util.c index da2cd11b3025..52458462d577 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); @@ -707,7 +707,7 @@ void memcpy_from_bio(void *dst, struct bio *src, struct bvec_iter src_iter) #if 0 void eytzinger1_test(void) { - unsigned inorder, eytz, size; + unsigned inorder, size; pr_info("1 based eytzinger test:"); @@ -740,7 +740,7 @@ void eytzinger1_test(void) void eytzinger0_test(void) { - unsigned inorder, eytz, size; + unsigned inorder, size; pr_info("0 based eytzinger test:"); @@ -770,7 +770,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; @@ -793,8 +793,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); } @@ -812,9 +812,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); |
