Skip to content

Commit 6bf0eb5

Browse files
John Garryaxboe
authored andcommitted
sbitmap: Consider cleared bits in sbitmap_bitmap_show()
sbitmap works by maintaining separate bitmaps of set and cleared bits. The set bits are cleared in a batch, to save the burden of continuously locking the "word" map to unset. sbitmap_bitmap_show() only shows the set bits (in "word"), which is not too much use, so mask out the cleared bits. Fixes: ea86ea2 ("sbitmap: ammortize cost of clearing bits") Signed-off-by: John Garry <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 1008fe6 commit 6bf0eb5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/sbitmap.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,11 @@ void sbitmap_bitmap_show(struct sbitmap *sb, struct seq_file *m)
292292

293293
for (i = 0; i < sb->map_nr; i++) {
294294
unsigned long word = READ_ONCE(sb->map[i].word);
295+
unsigned long cleared = READ_ONCE(sb->map[i].cleared);
295296
unsigned int word_bits = READ_ONCE(sb->map[i].depth);
296297

298+
word &= ~cleared;
299+
297300
while (word_bits > 0) {
298301
unsigned int bits = min(8 - byte_bits, word_bits);
299302

0 commit comments

Comments
 (0)