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

Lennart Poettering lennart at poettering.net
Sun Sep 26 17:00:18 PDT 2010


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?

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list