[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250719212441.402681-1-yury.norov@gmail.com>
Date: Sat, 19 Jul 2025 17:24:40 -0400
From: Yury Norov <yury.norov@...il.com>
To: Jens Axboe <axboe@...nel.dk>,
Yang Yang <yang.yang@...o.com>,
Ming Lei <ming.lei@...hat.com>,
Yury Norov <yury.norov@...il.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH] sbitmap: simplify __sbitmap_for_each_set()
From: Yury Norov (NVIDIA) <yury.norov@...il.com>
The function opencodes for_each_set_bit_from(). Fix that and drop most
of the housekeeping code.
Signed-off-by: Yury Norov (NVIDIA) <yury.norov@...il.com>
---
include/linux/sbitmap.h | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h
index 189140bf11fc..90a702a249e6 100644
--- a/include/linux/sbitmap.h
+++ b/include/linux/sbitmap.h
@@ -279,15 +279,9 @@ static inline void __sbitmap_for_each_set(struct sbitmap *sb,
* On all other iterations, nr is zero, so this is a noop.
*/
depth += nr;
- while (1) {
- nr = find_next_bit(&word, depth, nr);
- if (nr >= depth)
- break;
+ for_each_set_bit_from(nr, &word, depth)
if (!fn(sb, (index << sb->shift) + nr, data))
return;
-
- nr++;
- }
next:
nr = 0;
if (++index >= sb->map_nr)
--
2.43.0
Powered by blists - more mailing lists