Linux block layer
 help / color / mirror / Atom feed
From: John Garry <john.g.garry@oracle.com>
To: Yao Sang <sangyao@kylinos.cn>,
	axboe@kernel.dk, kbusch@kernel.org, hch@lst.de, sagi@grimberg.me
Cc: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
	john.garry@linux.dev
Subject: Re: [PATCH v3 5/5] block, nvme: add same-LBA multipath limit helpers
Date: Mon, 7 Sep 2026 10:44:09 +0100	[thread overview]
Message-ID: <29fd52d0-a4c6-4198-8495-c02ac4de5d8a@oracle.com> (raw)
In-Reply-To: <20260821101050.1464087-6-sangyao@kylinos.cn>

On 21/08/2026 11:10, Yao Sang wrote:
> A same-LBA multipath head and its paths address the same logical block
> space, so they do not need mapped-range topology calculations.
> 
> Add blk_stack_mpath_limits() to stack limits that may differ between
> paths, and blk_set_mpath_head_limits() to set head limits that are
> expected to be identical across paths. Export both helpers and use them
> for NVMe namespace heads.
> 
> Initialize max_hw_discard_sectors to UINT_MAX before stacking the first
> path. A zero limit means that a path does not support discard, so it
> disables discard for the head.
> 
> Signed-off-by: Yao Sang<sangyao@kylinos.cn>
> ---
>    block/blk-settings.c          | 58 +++++++++++++++++++++++++++++++++++
>    drivers/nvme/host/core.c      | 34 ++-------------------
>    drivers/nvme/host/multipath.c |  2 ++
>    include/linux/blkdev.h        |  3 ++
>    4 files changed, 65 insertions(+), 32 deletions(-)
> 
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index eaba38370657..8f70bab0a814 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -800,6 +800,64 @@ static void blk_stack_path_limits(struct queue_limits *t,
>    	t->dma_alignment = max(t->dma_alignment, b->dma_alignment);
>    }
>    
> +/**
> + * blk_set_mpath_head_limits - set head limits common to all paths
> + * @t: limits for the multipath head
> + * @b: limits for one path
> + *
> + * Set head limits that are expected to be identical across paths. Stack
> + * limits that may differ between paths with blk_stack_mpath_limits().
> + */
> +void blk_set_mpath_head_limits(struct queue_limits *t,
> +			       struct queue_limits *b)

nit: mpath_head is a NVMe multipath term, so maybe we need something 
more generic

> +{
> +	t->logical_block_size = b->logical_block_size;
> +	t->physical_block_size = b->physical_block_size;
> +	t->alignment_offset = b->alignment_offset;
> +	t->io_min = b->io_min;
> +	t->io_opt = b->io_opt;

I would not say that io_opt is really fixed for the disk. For SCSI, we 
change this value from transport/HBA factors - see sd_revalidate_disk() 
and how io_opt may change from the SCSI HBA limits.

I think that you need to take a conservative approach here in deciding 
what is a fixed limit for a disk.

> +	t->discard_granularity = b->discard_granularity;
> +	t->discard_alignment = b->discard_alignment;
> +	t->zone_write_granularity = b->zone_write_granularity;
> +	t->max_write_streams = b->max_write_streams;
> +	t->write_stream_granularity = b->write_stream_granularity;
> +}
> +EXPORT_SYMBOL_GPL(blk_set_mpath_head_limits);


  reply	other threads:[~2026-09-07  9:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 10:10 [PATCH v3 0/5] block, nvme: support same-LBA multipath limit stacking Yao Sang
2026-08-21 10:10 ` [PATCH v3 1/5] nvme: factor namespace-head queue-limit update Yao Sang
2026-08-21 10:10 ` [PATCH v3 2/5] block: factor mapped-range topology out of blk_stack_limits Yao Sang
2026-08-21 10:10 ` [PATCH v3 3/5] block: factor path limits " Yao Sang
2026-08-21 10:10 ` [PATCH v3 4/5] block: factor atomic write hardware limit stacking Yao Sang
2026-08-21 10:10 ` [PATCH v3 5/5] block, nvme: add same-LBA multipath limit helpers Yao Sang
2026-09-07  9:44   ` John Garry [this message]
2026-08-31  8:03 ` [PATCH v3 0/5] block, nvme: support same-LBA multipath limit stacking Yao Sang
2026-09-07  9:34 ` John Garry
2026-09-10 10:08   ` 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=29fd52d0-a4c6-4198-8495-c02ac4de5d8a@oracle.com \
    --to=john.g.garry@oracle.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=john.garry@linux.dev \
    --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