[PATCH 03/16] block: add bdev_zone_no helper

Pankaj Raghav p.raghav at samsung.com
Thu Apr 28 08:40:52 PDT 2022


On 2022-04-28 01:31, Damien Le Moal wrote:

>> +static inline unsigned int bdev_zone_no(struct block_device *bdev, sector_t sec)
>> +{
>> +	struct request_queue *q = bdev_get_queue(bdev);
>> +
>> +	if (q)
> 
> q is never NULL. So this can be simplified to:
> 
That is a good point. I just noticed it in the bdev_get_queue() function
that q can never be NULL. I will fix it up.

All the functions `bdev*` have this pattern, so probably they could be
simplified as well in the future.
> 	return blk_queue_zone_no(bdev_get_queue(bdev), sector);
> 
>> +		return blk_queue_zone_no(q, sec);
>> +	return 0;
>> +}
>> +
>>  static inline unsigned int bdev_max_open_zones(struct block_device *bdev)
>>  {
>>  	struct request_queue *q = bdev_get_queue(bdev);
> 
> 



More information about the Linux-nvme mailing list