[systemd-devel] [PATCH 2/6] readahead-common:fs_on_ssd() stat might not get the real device name

Kay Sievers kay.sievers at vrfy.org
Sun Sep 26 21:10:23 PDT 2010


On Mon, Sep 27, 2010 at 02:00, Lennart Poettering
<lennart at poettering.net> wrote:
> On Fri, 24.09.10 12:22, Kay Sievers (kay.sievers at vrfy.org) wrote:
>
>> On Fri, Sep 24, 2010 at 12:06,  <harald at redhat.com> wrote:
>> > From: Harald Hoyer <harald at redhat.com>
>> >
>> > btrfs returns a major(0) for its device, so try to find the mountpoint and real device.
>>
>> > +        fp = fopen("/proc/self/mountinfo", "r");
>> > +        if (fp == NULL)
>> > +                return NULL;
>> > +        while (fscanf(fp, "%*s %*s %i:%i %*s %1024s %*s %*s %*s %1024s %*[^\n]", &maj, &min, mp, dev)
>>
>> Using device names from this file is not nice. I have just /dev/root
>> here. Shouldn't we just read the kernel commandline instead?
>
> As long as it is just btrfs we probably could use some btrfs-specific
> ioctls to figure out whether something is ssd. However, for root on LVM
> we'd have the same problem and neither btrfs ioctls nor parsing
> /proc/self/mountinfo would help there. Maybe this is something the
> kernel people should fix? maybe a new FS_IOC_GETFLAGS flag that
> indicates "at least one rotating block device is part of this fs" or so?

Doesn't:
  ls -l /sys/class/block/*/slaves/
show it?

Kay


More information about the systemd-devel mailing list