From: Loic Dachary <loic@dachary.org>
To: Ilya Dryomov <idryomov@gmail.com>
Cc: Ceph Development <ceph-devel@vger.kernel.org>
Subject: Re: /sys/block and /dev and partitions
Date: Tue, 18 Aug 2015 12:13:48 +0200 [thread overview]
Message-ID: <55D3055C.6090606@dachary.org> (raw)
In-Reply-To: <CAOi1vP8Mab1M10Gr+L-eWw=tH2hd6A8DK+jm9sxKqCQ3kfG5PQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1172 bytes --]
On 18/08/2015 11:53, Ilya Dryomov wrote:
> On Tue, Aug 18, 2015 at 12:46 AM, Loic Dachary <loic@dachary.org> wrote:
>> Hi Ilya,
>>
>> For regular devices such as /dev/vdb2 or /dev/sda3, do you think it is safe to use /sys/dev/block/M:m/partition to figure out the partition number ? Or could it vary depending on the disk driver or the partition table layout ? Or the kernel version ?
>
> Yes, I think it is. "partition" was added specifically for finding out
> partition numbers after extended devt scheme was merged, because it
> made it impossible to use arithmetic on minor numbers. That happened
> around 2.6.27 - 2.6.28, so it's a more recent one compared to others,
> but I don't think you care about anything pre 2.6.32.
>
> (You could choose not to rely on "partition" and access() "start" for
> figuring out if the thing is a partition - it's been around forever,
> but then, the only way to figure out the partition index would be to
> parse the name, which you want to avoid.)
Exactly. Really happy to get rid of the name parsing logic :-)
> Thanks,
>
> Ilya
>
--
Loïc Dachary, Artisan Logiciel Libre
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
prev parent reply other threads:[~2015-08-18 10:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-15 11:16 /sys/block and /dev and partitions Loic Dachary
2015-08-15 14:28 ` Sage Weil
2015-08-15 15:35 ` Loic Dachary
2015-08-15 17:42 ` Ilya Dryomov
2015-08-15 20:56 ` Loic Dachary
2015-08-15 22:00 ` Ilya Dryomov
2015-08-15 22:10 ` Loic Dachary
2015-08-17 21:46 ` Loic Dachary
2015-08-18 9:53 ` Ilya Dryomov
2015-08-18 10:13 ` Loic Dachary [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=55D3055C.6090606@dachary.org \
--to=loic@dachary.org \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.