Mark Lord wrote:
Chris / list,

stat(2) seems to return invalid major/minor device info
for btrfs filesystems.

Why?  Is this a bug?

Eg.

    [~] uname -r
    2.6.31-rc6
    [~] mkfs.btrfs /dev/sdb
WARNING! - Btrfs Btrfs v0.19 IS EXPERIMENTAL
    WARNING! - see http://btrfs.wiki.kernel.org before using
fs created label (null) on /dev/sdb
            nodesize 4096 leafsize 4096 sectorsize 4096 size 30.06GB
    Btrfs Btrfs v0.19
    [~] mount /dev/sdb /x -t btrfs
    [~] stat --format="%04D" /x
    0017
    [~] touch /x/junk
    [~] stat --format="%04D" /x/junk
    0017

This gives major=0x00, minor=0x17 for /dev/sdb,
which should have major=8, minor=0x10.
..

Mmm.. btrfs appears to configure itself as a "pseudo" filesystem,
which is why it returns fake device numbers via stat(),
similar to procfs or sysfs.

The problem I'm trying to solve, is how to determine the underlying
block device node for a mounted btrfs filesystem.

Well, actually, the other way around:  given a block device major:minor,
how to determine whether or not this block device is currently mounted.

Simple, eh?  Except for the silly "/dev/root" stuff that some distros practice.

????????
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to