Re: [PATCH 1/4] block: factor out a helper to set logical/physical block size

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

 



On Tue, Mar 04, 2025 at 08:19:15PM +0800, linan666@xxxxxxxxxxxxxxx wrote:
> +extern int blk_set_block_size(struct queue_limits *t, unsigned int logical_block_size,

No need for the extern.

> +int blk_set_block_size(struct queue_limits *t, unsigned int logical_block_size,
> +		     unsigned int physical_block_size)


As Bart said this really needs documentation, both in the commit message
and the code.  It appears to be a subset of the queue limits stacking,
but I have no idea why that is needed, and the set_ name also confers
the wrong implications to me gіven the stacking logic.

> +{
> +	int ret = 0;

ret is always 0 or -1, so using a bool would be better.

> +	t->max_sectors = blk_round_down_sectors(t->max_sectors, t->logical_block_size);
> +	t->max_hw_sectors = blk_round_down_sectors(t->max_hw_sectors, t->logical_block_size);
> +	t->max_dev_sectors = blk_round_down_sectors(t->max_dev_sectors, t->logical_block_size);

Please avoid the overly long lines.

> +
> +	return ret;
> +}
> +EXPORT_SYMBOL(blk_set_block_size);

At best this should be a EXPORT_SYMBOL_GPL.





[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux