From: John Garry <john.g.garry@oracle.com>
To: Yao Sang <sangyao@kylinos.cn>, Jens Axboe <axboe@kernel.dk>,
Keith Busch <kbusch@kernel.org>, Christoph Hellwig <hch@lst.de>,
Sagi Grimberg <sagi@grimberg.me>
Cc: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org
Subject: Re: [PATCH v2 2/4] block: factor block size and alignment handling out of blk_stack_limits
Date: Mon, 17 Aug 2026 18:05:28 +0100 [thread overview]
Message-ID: <58358ff3-2c59-4ebb-bfa7-3ef22a7fb1a3@oracle.com> (raw)
In-Reply-To: <20260806024658.4193386-3-sangyao@kylinos.cn>
On 06/08/2026 03:46, Yao Sang wrote:
> Topology limits are the block size and alignment limits that the top
> device exposes after its data is placed at an offset on a bottom device.
> blk_stack_limits() uses start, the first data sector in the bottom device
> used by the top device, to calculate alignment_offset.
>
> It then stacks logical_block_size, physical_block_size, io_min, io_opt and
> chunk_sectors, checks that they are compatible, and rounds max_sectors,
> max_hw_sectors and max_dev_sectors down to the final logical_block_size.
>
> Keep these operations together because the checks and rounding must run
> after the final logical and physical block sizes are known. Factor them
> into a static blk_stack_topology_limits() helper.
It still is not clear to me what is the criteria for a limit to be
evaluated in blk_stack_topology_limits() (and not in blk_stack_limits()).
You seem to be just saying that some limits need to be calculated before
other dependent limits, so put them in a separate function.
>
> There is no behavior change.
> > Signed-off-by: Yao Sang <sangyao@kylinos.cn>
> ---
> block/blk-settings.c | 169 ++++++++++++++++++++++++-------------------
> 1 file changed, 93 insertions(+), 76 deletions(-)
>
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index 8274631290db..1aff818aaaac 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -756,6 +756,96 @@ static void blk_stack_atomic_writes_limits(struct queue_limits *t,
> t->atomic_write_hw_boundary = 0;
> }
>
> +/*
> + * Stack and check logical_block_size, physical_block_size, io_min, io_opt,
> + * chunk_sectors and alignment_offset for a bottom-device range, then round
> + * max_sectors, max_hw_sectors and max_dev_sectors to logical_block_size.
> + */
This just describes what the code does. Anyone can see that.
> +static int blk_stack_topology_limits(struct queue_limits *t,
> + const struct queue_limits *b, sector_t start)
> +{
> + unsigned int top, bottom, alignment;
> + int ret = 0;
next prev parent reply other threads:[~2026-08-17 17:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 2:46 [PATCH v2 0/4] block/nvme: split path limits for namespace heads Yao Sang
2026-08-06 2:46 ` [PATCH v2 1/4] nvme: factor namespace-head queue-limit update Yao Sang
2026-08-17 8:04 ` Christoph Hellwig
2026-08-17 16:32 ` John Garry
2026-08-06 2:46 ` [PATCH v2 2/4] block: factor block size and alignment handling out of blk_stack_limits Yao Sang
2026-08-17 8:05 ` Christoph Hellwig
2026-08-17 17:05 ` John Garry [this message]
2026-08-06 2:46 ` [PATCH v2 3/4] block: factor out path limit stacking Yao Sang
2026-08-17 8:10 ` Christoph Hellwig
2026-08-06 2:46 ` [PATCH v2 4/4] block, nvme: use lower-level limit helpers for namespace heads Yao Sang
2026-08-17 8:13 ` Christoph Hellwig
2026-08-10 8:50 ` [PATCH v2 0/4] block/nvme: split path limits " Yao Sang
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=58358ff3-2c59-4ebb-bfa7-3ef22a7fb1a3@oracle.com \
--to=john.g.garry@oracle.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
--cc=sangyao@kylinos.cn \
/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