Message ID | 20230116205059.3821738-3-shikemeng@huaweicloud.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | A few bugfix and cleanup patches for sbitmap | expand |
diff --git a/lib/sbitmap.c b/lib/sbitmap.c index 462873a4337c..eb45a2d7916e 100644 --- a/lib/sbitmap.c +++ b/lib/sbitmap.c @@ -518,11 +518,9 @@ unsigned long __sbitmap_queue_get_batch(struct sbitmap_queue *sbq, int nr_tags, get_mask = ((1UL << nr_tags) - 1) << nr; val = READ_ONCE(map->word); - do { - if ((val & ~get_mask) != val) - goto next; - } while (!atomic_long_try_cmpxchg(ptr, &val, - get_mask | val)); + while (!atomic_long_try_cmpxchg(ptr, &val, + get_mask | val)) + ; get_mask = (get_mask & ~val) >> nr; if (get_mask) { *offset = nr + (index << sb->shift);