Linux block layer
 help / color / mirror / Atom feed
From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: Chaitanya Kulkarni <chaitanyak@nvidia.com>
Cc: "axboe@kernel.dk" <axboe@kernel.dk>,
	"ming.lei@redhat.com" <ming.lei@redhat.com>,
	"shinichiro.kawasaki@wdc.com" <shinichiro.kawasaki@wdc.com>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: Re: [PATCH 1/1] null-blk: replace deprecated ida_simple_xxx()
Date: Thu, 10 Mar 2022 11:15:22 +0900	[thread overview]
Message-ID: <26978007-81ef-2249-c6fb-593be5aed907@opensource.wdc.com> (raw)
In-Reply-To: <bcf0efa6-6fa0-5e81-64f4-b78a07e4dd65@nvidia.com>

On 3/10/22 11:02, Chaitanya Kulkarni wrote:
> On 3/9/22 17:57, Chaitanya Kulkarni wrote:
>> On 3/9/22 15:38, Damien Le Moal wrote:
>>> On 3/10/22 07:02, Chaitanya Kulkarni wrote:
>>
>> [..]
>>
>>>> @@ -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.
>>>
>>
>> Good point, but original code doesn't have error checking, this patch
>> eventually ends up calling same function what original code was doing.
>>
>> Since this is just a replacement patch should we add a 2nd patch on the
>> top of this for error handling ? or you prefer to have it in the same
>> one ?
>>
>> -ck
>>
> 
> Also nullb->index is defined as unsigned int [1] so in order to add
> error handling we need to change the type of variable, so I think it
> makes to make it a separate patch than removing deprecated API, lmk.

One patch to add the missing error check and change the index type, with
cc stable for backport, and a second patch to switch to the new api on
top of the fix, without cc stable. No ?

> 
> -ck
> 
> [1]
> 109 struct nullb {
> 110         struct nullb_device *dev;
> 111         struct list_head list;
> *112         unsigned int index;*
> 113         struct request_queue *q;
> 114         struct gendisk *disk;
> 115         struct blk_mq_tag_set *tag_set;
> 116         struct blk_mq_tag_set __tag_set;
> 117         unsigned int queue_depth;
> 118         atomic_long_t cur_bytes;
> 119         struct hrtimer bw_timer;
> 120         unsigned long cache_flush_pos;
> 121         spinlock_t lock;
> 122
> 123         struct nullb_queue *queues;
> 124         unsigned int nr_queues;
> 125         char disk_name[DISK_NAME_LEN];
> 126 };
> 127
> 128 blk_status_t null_handle_discard(struct nullb_device *dev, sector_t 
> sector,
> 129                                  sector_t nr_sectors);
> 
> 
> 


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2022-03-10  2:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-09 22:02 [PATCH 0/1] null_blk: replace ida_simple_xxx() Chaitanya Kulkarni
2022-03-09 22:02 ` [PATCH 1/1] null-blk: replace deprecated ida_simple_xxx() Chaitanya Kulkarni
2022-03-09 23:38   ` Damien Le Moal
2022-03-10  1:57     ` Chaitanya Kulkarni
2022-03-10  2:02       ` Chaitanya Kulkarni
2022-03-10  2:15         ` Damien Le Moal [this message]
2022-03-14 23:19           ` Chaitanya Kulkarni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26978007-81ef-2249-c6fb-593be5aed907@opensource.wdc.com \
    --to=damien.lemoal@opensource.wdc.com \
    --cc=axboe@kernel.dk \
    --cc=chaitanyak@nvidia.com \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=shinichiro.kawasaki@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox