From: John Garry <john.garry@linux.dev>
To: Keith Busch <kbusch@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>,
Christoph Hellwig <hch@lst.de>,
sagi@grimberg.me, axboe@fb.com, linux-nvme@lists.infradead.org,
linux-block@vger.kernel.org
Subject: Re: [PATCH RFC] nvme-multipath: fix diskstats for partitions
Date: Fri, 24 Jul 2026 17:56:35 +0100 [thread overview]
Message-ID: <94ed42ce-895d-4197-994b-60fc1d3f040c@linux.dev> (raw)
In-Reply-To: <amOGxr3rxvDflHLv@kbusch-mbp>
On 7/24/26 16:37, Keith Busch wrote:
> On Fri, Jul 24, 2026 at 04:29:08PM +0100, John Garry wrote:
>> On 7/24/26 13:45, Keith Busch wrote:
>>> Can we just thread through partitions for the bio's block_device instead
>>> of assuming part0? I know the hidden path devices skip partition
>>> scanning, but maybe if we let it happen, then those will have the same
>>> partition setup as the head gendisk. Then we can go right to the
>>> disk->part_tbl for what we provide to bio_set_dev() for both submission
>>> and failover, and everything should work out from there.
>>
>> I guess that we would just scan through the per-path gendisk->part_tbl and
>> match somehow to lookup the partition. Maybe vs start address of
>> bio->bi_bdev. Or is there a simpler (and quicker) way?
>>
>
> This is the idea, assuming we can get the partition tables of the head
> and path disks to be aligned:
>
> ---
> --- a/drivers/nvme/host/multipath.c
> +++ b/drivers/nvme/host/multipath.c
> @@ -543,7 +543,10 @@ static void nvme_ns_head_submit_bio(struct bio *bio)
> srcu_idx = srcu_read_lock(&head->srcu);
> ns = nvme_find_path(head);
> if (likely(ns)) {
> - bio_set_dev(bio, ns->disk->part0);
> + struct block_device *bdev;
> +
> + bdev = xa_load(&ns->disk->part_tbl, bdev_partno(bio->bi_bdev));
> + bio_set_dev(bio, bdev);
> /*
> * Use BIO_REMAPPED to skip bio_check_eod() when this bio
> * enters submit_bio_noacct() for the per-path device. The EOD
> --
ok, got it.
And I think that we would need to do the reverse lookup in
nvme_mpath_start_request() and nvme_mpath_end_request() to get the head
disk partition, like:
bdev = xa_load(&ns->head->disk->part_tbl, bdev_partno(bio->bi_bdev));
I suppose that the tricky part now would be have the per-path disk scan
run but keep those per-path disks hidden.
I experimented by stop setting GENHD_FL_HIDDEN for the per-path disk,
and the diskstats look ok, FWIW.
prev parent reply other threads:[~2026-07-24 16:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 11:45 [PATCH RFC] nvme-multipath: fix diskstats for partitions John Garry
2026-07-24 5:01 ` Christoph Hellwig
2026-07-24 7:09 ` John Garry
2026-07-24 12:45 ` Keith Busch
2026-07-24 15:29 ` John Garry
2026-07-24 15:37 ` Keith Busch
2026-07-24 16:56 ` John Garry [this message]
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=94ed42ce-895d-4197-994b-60fc1d3f040c@linux.dev \
--to=john.garry@linux.dev \
--cc=axboe@fb.com \
--cc=hch@lst.de \
--cc=john.g.garry@oracle.com \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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