From: Keith Busch <kbusch@kernel.org>
To: John Garry <john.garry@linux.dev>
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 09:37:42 -0600 [thread overview]
Message-ID: <amOGxr3rxvDflHLv@kbusch-mbp> (raw)
In-Reply-To: <f76e9466-4b66-4a32-a491-728e24d34052@linux.dev>
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
--
next prev parent reply other threads:[~2026-07-24 15:37 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 [this message]
2026-07-24 16:56 ` John Garry
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=amOGxr3rxvDflHLv@kbusch-mbp \
--to=kbusch@kernel.org \
--cc=axboe@fb.com \
--cc=hch@lst.de \
--cc=john.g.garry@oracle.com \
--cc=john.garry@linux.dev \
--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