Re: [PATCH v3] block: ublk: enable zoned storage support
From: Andreas Hindborg (Samsung)
Date: Wed Jun 28 2023 - 07:54:14 EST
Niklas Cassel <Niklas.Cassel@xxxxxxx> writes:
> On Thu, Mar 16, 2023 at 03:55:38PM +0100, Andreas Hindborg wrote:
>> From: Andreas Hindborg <a.hindborg@xxxxxxxxxxx>
>
> Hello Andreas,
>
>
> I think that this patch is starting to look very nice!
Thanks!
>
>
<snip>
>> +
>> +int ublk_report_zones(struct gendisk *disk, sector_t sector,
>> + unsigned int nr_zones, report_zones_cb cb, void *data)
>> +{
>> + unsigned int done_zones = 0;
>> + struct ublk_device *ub = disk->private_data;
>> + unsigned int zone_size_sectors = disk->queue->limits.chunk_sectors;
>> + unsigned int first_zone = sector >> ilog2(zone_size_sectors);
>> + struct blk_zone *buffer;
>> + size_t buffer_length;
>> + unsigned int max_zones_per_request;
>
> Nit: I would sort the variables differently.
>
> Perhaps:
>> + struct ublk_device *ub = disk->private_data;
>> + unsigned int zone_size_sectors = disk->queue->limits.chunk_sectors;
>> + unsigned int first_zone = sector >> ilog2(zone_size_sectors);
>> + unsigned int done_zones = 0;
>> + unsigned int max_zones_per_request;
>> + struct blk_zone *buffer;
>> + size_t buffer_length;
>
Can I ask what is the reasoning behind this? I think they way you
propose looks better, but are there any rules one can follow for this?
Best regards
Andreas