Re: [PATCH] block: align max append sectors to physical block size

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

 



On Thu, Jul 16, 2020 at 07:09:33PM +0900, Johannes Thumshirn wrote:
> Max append sectors needs to be aligned to physical block size, otherwise
> we can end up in a situation where it's off by 1-3 sectors which would
> cause short writes with asynchronous zone append submissions from an FS.

Huh? The physical block size is purely a hint.

> 
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>
> ---
>  block/blk-settings.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index 9a2c23cd9700..d75c4cc34a7a 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -231,6 +231,7 @@ EXPORT_SYMBOL(blk_queue_max_write_zeroes_sectors);
>  void blk_queue_max_zone_append_sectors(struct request_queue *q,
>  		unsigned int max_zone_append_sectors)
>  {
> +	unsigned int phys = queue_physical_block_size(q);
>  	unsigned int max_sectors;
>  
>  	if (WARN_ON(!blk_queue_is_zoned(q)))
> @@ -246,6 +247,13 @@ void blk_queue_max_zone_append_sectors(struct request_queue *q,
>  	 */
>  	WARN_ON(!max_sectors);
>  
> +	/*
> +	 * Max append sectors needs to be aligned to physical block size,
> +	 * otherwise we can end up in a situation where it's off by 1-3 sectors
> +	 * which would cause short writes with asynchronous zone append
> +	 * submissions from an FS.
> +	 */
> +	max_sectors = ALIGN_DOWN(max_sectors << 9, phys) >> 9;
>  	q->limits.max_zone_append_sectors = max_sectors;
>  }
>  EXPORT_SYMBOL_GPL(blk_queue_max_zone_append_sectors);
> -- 
> 2.26.2
> 
---end quoted text---



[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