[systemd-devel] [PATCH] swap: introduce Discard property

Karel Zak kzak at redhat.com
Wed Oct 1 00:19:48 PDT 2014


On Mon, Sep 29, 2014 at 06:52:12PM +0200, Zbigniew Jędrzejewski-Szmek wrote:
> On Mon, Sep 29, 2014 at 08:35:04PM +0400, Andrei Borzenkov wrote:
> > В Mon, 29 Sep 2014 17:16:25 +0200
> > Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl> пишет:
> > 
> > > 
> > > The problem with reading but back discards settings remains.
> > > 
> > 
> > Seems like the most natural solution is to extend /proc/swaps. The only
> > place where these flags are printed right now is in dmesg during swapon.

I have talked about this issue with Lukas (CC:) who is working on
discard stuff in kernel. I hope we will see any solution :-)

> Yeah, but how can you extend /proc/swaps in a backwards compatible way?
> Like many kernel interfaces, it was designed with no thought towards
> extensibility. A new file would have to be created (/proc/swapinfo?).

Frankly, the /proc concept is broken. It designed as human readable
kernel interface (e.g. "cat /proc/mounts"), but it's horrible as
interface to distribute information to userspace.

It's painful that kernel provides information by formatted files where
is necessary to care about backward compatibility. The better thing is
sysfs concept where is attribute (info) per file. It's easy to extend,
easy to parse (let's imagine /proc/swaps/sda1/{discard,priority,...}
files :)

    Karel

-- 
 Karel Zak  <kzak at redhat.com>
 http://karelzak.blogspot.com


More information about the systemd-devel mailing list