Skip to content

Commit 2abd9a1

Browse files
tititiou36axboe
authored andcommitted
bcache: Remove usage of the deprecated ida_simple_xx() API
ida_alloc() and ida_free() should be preferred to the deprecated ida_simple_get() and ida_simple_remove(). Note that the upper limit of ida_simple_get() is exclusive, but the one of ida_alloc_max() is inclusive. So a -1 has been added when needed. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Coly Li <colyli@suse.de> Link: https://lore.kernel.org/r/20240509011117.2697-2-colyli@suse.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 504fbcf commit 2abd9a1

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

drivers/md/bcache/super.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -881,8 +881,8 @@ static void bcache_device_free(struct bcache_device *d)
881881
bcache_device_detach(d);
882882

883883
if (disk) {
884-
ida_simple_remove(&bcache_device_idx,
885-
first_minor_to_idx(disk->first_minor));
884+
ida_free(&bcache_device_idx,
885+
first_minor_to_idx(disk->first_minor));
886886
put_disk(disk);
887887
}
888888

@@ -940,8 +940,8 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size,
940940
if (!d->full_dirty_stripes)
941941
goto out_free_stripe_sectors_dirty;
942942

943-
idx = ida_simple_get(&bcache_device_idx, 0,
944-
BCACHE_DEVICE_IDX_MAX, GFP_KERNEL);
943+
idx = ida_alloc_max(&bcache_device_idx, BCACHE_DEVICE_IDX_MAX - 1,
944+
GFP_KERNEL);
945945
if (idx < 0)
946946
goto out_free_full_dirty_stripes;
947947

@@ -986,7 +986,7 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size,
986986
out_bioset_exit:
987987
bioset_exit(&d->bio_split);
988988
out_ida_remove:
989-
ida_simple_remove(&bcache_device_idx, idx);
989+
ida_free(&bcache_device_idx, idx);
990990
out_free_full_dirty_stripes:
991991
kvfree(d->full_dirty_stripes);
992992
out_free_stripe_sectors_dirty:

0 commit comments

Comments
 (0)