From: Daniel Wagner <dwagner@suse.de>
To: Sagi Grimberg <sagi@grimberg.me>
Cc: Stefan Hajnoczi <stefanha@redhat.com>, linux-nvme@lists.infradead.org
Subject: Re: How to look up an ns cdev from block maj:min?
Date: Wed, 15 Feb 2023 10:56:33 +0100 [thread overview]
Message-ID: <20230215095633.knzzi5z6737feeyu@carbon.lan> (raw)
In-Reply-To: <7f958c6d-d6e6-2346-a680-875c7fafe7e5@grimberg.me>
On Wed, Feb 15, 2023 at 10:41:08AM +0200, Sagi Grimberg wrote:
>
> > Hi,
> > Is there an official way for userspace to look up an ns cdev from a
> > block maj:min?
> >
> > For example, how should a userspace program determine that /dev/ng0n1 is
> > the corresponding ns cdev when given just the block device node
> > /dev/nvme0n1?
> >
> > Parsing the filename is an obvious option but it makes assumptions about
> > the naming convention of both the block device node and the character
> > device node.
> >
> > Is there a better way via sysfs? (I couldn't find it.)
>
> Not that I can see... It follows the same rules as the
> normal namespace, which means that it takes the subsystem or ctrl
> instance number (depending if multipathing is enabled) and it will have
> the same namespace instance number.
>
> In other words, every namespace nvmeXnY will present an 'nvme generic'
> chardev in the form of ngXnY.
>
> Looks like nvme-cli is missing the generic representation in the json
> output as well. Perhaps that is the best tool to use (once fixed with
> the json output with the below):
Looks good. I've created a PR for it.
https://github.com/linux-nvme/nvme-cli/pull/1820
Can I add your SoB?
next prev parent reply other threads:[~2023-02-15 9:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-14 21:27 How to look up an ns cdev from block maj:min? Stefan Hajnoczi
2023-02-15 8:41 ` Sagi Grimberg
2023-02-15 9:56 ` Daniel Wagner [this message]
2023-02-15 10:09 ` Daniel Wagner
2023-02-15 15:51 ` Stefan Hajnoczi
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=20230215095633.knzzi5z6737feeyu@carbon.lan \
--to=dwagner@suse.de \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
--cc=stefanha@redhat.com \
/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