Re: [PATCH 1/1] null-blk: replace deprecated ida_simple_xxx()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/10/22 07:02, Chaitanya Kulkarni wrote:
> Like various places in kernel replace deprecated ida_simple_get() and
> ida_simple_remove with ida_alloc() and ida_free().
> 
> Signed-off-by: Chaitanya Kulkarni <kch@xxxxxxxxxx>
> ---
>  drivers/block/null_blk/main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
> index 05b1120e6623..e077be800606 100644
> --- a/drivers/block/null_blk/main.c
> +++ b/drivers/block/null_blk/main.c
> @@ -1724,7 +1724,7 @@ static void null_del_dev(struct nullb *nullb)
>  
>  	dev = nullb->dev;
>  
> -	ida_simple_remove(&nullb_indexes, nullb->index);
> +	ida_free(&nullb_indexes, nullb->index);
>  
>  	list_del_init(&nullb->list);
>  
> @@ -2044,7 +2044,7 @@ static int null_add_dev(struct nullb_device *dev)
>  	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, nullb->q);
>  
>  	mutex_lock(&lock);
> -	nullb->index = ida_simple_get(&nullb_indexes, 0, 0, GFP_KERNEL);
> +	nullb->index = ida_alloc(&nullb_indexes, GFP_KERNEL);

Do we need error check here ? Not entirely sure if ida_free() tolerates
being passed a failed ida_alloc() nullb_indexes... A quick look at
ida_free() does not show anything obvious, so it may be worth checking
in detail.

>  	dev->index = nullb->index;
>  	mutex_unlock(&lock);
>  


-- 
Damien Le Moal
Western Digital Research



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux