Skip to content

Commit 2b02c21

Browse files
committed
sbitmap: remove unnecessary code in __sbitmap_queue_get_batch
jira LE-4066 Rebuild_History Non-Buildable kernel-4.18.0-553.72.1.el8_10 commit-author Liu Song <liusong@linux.alibaba.com> commit ddbfc34 If "nr + nr_tags <= map_depth", then the value of nr_tags will not be greater than map_depth, so no additional comparison is required. Signed-off-by: Liu Song <liusong@linux.alibaba.com> Link: https://lore.kernel.org/r/1661483653-27326-1-git-send-email-liusong@linux.alibaba.com Signed-off-by: Jens Axboe <axboe@kernel.dk> (cherry picked from commit ddbfc34) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent a42ee5e commit 2b02c21

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/sbitmap.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,10 +532,9 @@ unsigned long __sbitmap_queue_get_batch(struct sbitmap_queue *sbq, int nr_tags,
532532
nr = find_first_zero_bit(&map->word, map_depth);
533533
if (nr + nr_tags <= map_depth) {
534534
atomic_long_t *ptr = (atomic_long_t *) &map->word;
535-
int map_tags = min_t(int, nr_tags, map_depth);
536535
unsigned long val, ret;
537536

538-
get_mask = ((1UL << map_tags) - 1) << nr;
537+
get_mask = ((1UL << nr_tags) - 1) << nr;
539538
do {
540539
val = READ_ONCE(map->word);
541540
if ((val & ~get_mask) != val)
@@ -546,7 +545,7 @@ unsigned long __sbitmap_queue_get_batch(struct sbitmap_queue *sbq, int nr_tags,
546545
if (get_mask) {
547546
*offset = nr + (index << sb->shift);
548547
update_alloc_hint_after_get(sb, depth, hint,
549-
*offset + map_tags - 1);
548+
*offset + nr_tags - 1);
550549
return get_mask;
551550
}
552551
}

0 commit comments

Comments
 (0)