Re: [PATCH v3 1/3] block: introduce zone_write_granularity limit

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

 



On 2021/01/22 17:42, Christoph Hellwig wrote:
>> @@ -864,18 +891,20 @@ void blk_queue_set_zoned(struct gendisk *disk, enum blk_zoned_model model)
>>  		 * partitions and zoned block device support is enabled, else
>>  		 * we do nothing special as far as the block layer is concerned.
>>  		 */
>> -		if (!IS_ENABLED(CONFIG_BLK_DEV_ZONED) ||
>> -		    disk_has_partitions(disk))
>> -			model = BLK_ZONED_NONE;
>> -		break;
>> +		if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) &&
>> +		    !disk_has_partitions(disk))
>> +			break;
>> +		model = BLK_ZONED_NONE;
>> +		fallthrough;
>>  	case BLK_ZONED_NONE:
>>  	default:
>>  		if (WARN_ON_ONCE(model != BLK_ZONED_NONE))
>>  			model = BLK_ZONED_NONE;
>> +		q->limits.zone_write_granularity = 0;
>>  		break;
>>  	}
>>  
>> -	disk->queue->limits.zoned = model;
>> +	q->limits.zoned = model;
>>  }
> 
> This looks a little strange.  If we special case zoned vs not zoned
> here anyway, why not set the zone_write_granularity to the logical
> block size here by default.

The convention is zone_write_granularity == 0 for the BLK_ZONED_NONE case. Hence
the reset here if we force the zoned model to none for HA drives. This way, this
does not create a special case for HA drives used as regular disks.

Of note is that there is something a little weird in the sd_zbc.c code that
needs fixing: blk_queue_set_zoned() is called before sd_zbc_read_zones() is
executed and that function will check the zones of an HA drive and set the queue
nr_zones and max zone append sectors, even if blk_queue_set_zoned() set the
zoned model to none due to partitions. That makes the BLK_ZONED_NONE case of HA
drives a little weird since zone information is visible and correct but the
model says "none". As long as users separate zoned vs not-zoned cases by looking
at the zoned model, this does not create any problem, but that is not pretty.

Will send a separate patch to clean that up and have something consistent with
regular disks for this special HA case. The above blk_queue_set_zoned() function
can be used to cleanup the zones information for an HA drive that is used as a
regular disk (nr_zones, zone append sectors and zone bitmaps).


-- 
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