From: Christoph Hellwig <hch@infradead.org>
To: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org
Subject: Re: [PATCH] block: align max append sectors to physical block size
Date: Thu, 16 Jul 2020 15:34:41 +0100 [thread overview]
Message-ID: <20200716143441.GA937@infradead.org> (raw)
In-Reply-To: <20200716100933.3132-1-johannes.thumshirn@wdc.com>
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@wdc.com>
> ---
> 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---
next prev parent reply other threads:[~2020-07-16 14:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-16 10:09 [PATCH] block: align max append sectors to physical block size Johannes Thumshirn
2020-07-16 14:34 ` Christoph Hellwig [this message]
2020-07-17 2:45 ` Damien Le Moal
2020-07-17 7:50 ` Ming Lei
2020-07-17 8:22 ` Damien Le Moal
2020-07-17 9:11 ` Ming Lei
2020-07-17 9:19 ` Damien Le Moal
2020-07-17 10:02 ` Ming Lei
2020-07-17 10:55 ` Damien Le Moal
2020-07-20 11:08 ` hch
2020-07-20 12:32 ` Damien Le Moal
2020-07-20 12:34 ` hch
2020-07-20 12:35 ` Damien Le Moal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200716143441.GA937@infradead.org \
--to=hch@infradead.org \
--cc=axboe@kernel.dk \
--cc=johannes.thumshirn@wdc.com \
--cc=linux-block@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).