[systemd-devel] [PATCH RFC] swap: use aliases to group swap units for same device

Lennart Poettering lennart at poettering.net
Tue Oct 23 11:59:30 PDT 2012


On Tue, 23.10.12 18:52, Zbigniew Jędrzejewski-Szmek (zbyszek at in.waw.pl) wrote:

> 
> On Tue, Oct 23, 2012 at 05:48:57PM +0200, Kay Sievers wrote:
> > On Tue, Oct 23, 2012 at 5:34 PM, Lennart Poettering
> > <lennart at poettering.net> wrote:
> > > On Fri, 19.10.12 00:56, Zbigniew Jędrzejewski-Szmek (zbyszek at in.waw.pl) wrote:
> > >
> > >> A series of .swap units "following" one another are replaced with a
> > >> single unit with multiple names.
> > >>
> > >> The idea is to simplify things for the user: only one swap unit per
> > >> swap area. It shouldn't matter whether the swap area was activated by
> > >> systemd or by direct swapon invocation. The kernel name (from
> > >> /proc/swaps) is preferred, but if swap is configured through a unit
> > >> file and not active, that name will be used instead.
> > >>
> > >> The case where a swap unit refers (What=) to a symlink should behave
> > >> better than before.
> > >>
> > >> Note: this patch is goes on top of some cleanup patches that are
> > >> pretty boring and thus I'm not posting them, so it might not apply
> > >> cleanly.
> > >
> > > So here's the reason why we use the "following" scheme for htis, rather
> > > than just alias names. And that's simply because a name in /dev can
> > > refer to different things during runtime and we cannot model this with
> > > aliases.
> [snip]
> 
> OK, that makes sense. Thank you both for the explanation.
> 
> So, back to square one: should the user be presented with one swap "device"
> for every name the device can be found under? I think it makes for a crappy
> interface, because it is hard to distinguish (without actually checking),
> which .swap units refer to the same thing.

Yes, this is the idea we had in mind when we invented the "follow"
thingy. One of the swap devices should be selected as primray device and
all others "follow" it. The primary device should probably be the one
listed in /proc/swaps.

> One option would be to only show the "main" unit in systemctl listings,
> and hide all "following" units. But this creates units which are "hidden",
> so probably not a good idea.

Yeah, that's already what we do: systemctl does not list units where
"follow" is set. This means that the user will only see one unit in the
list, the primary one, which has the most "official name". --all will
show all of them however.

systemctl status also shows you the "Following" field.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list