Re: [systemd-devel] systemd-way for initialization zram swap

2013-01-05 Thread Maksim Melnikau
On Tue, Nov 20, 2012 at 2:30 AM, Lennart Poettering
 wrote:
> If this is upstream in the kernel I think the nicest way to handle this
> would be to extend util-linux to learn a new "zram" option or so we can
> just add to the fstab lines, which sets up everything as needed. This
> would then be similar to /dev/loop may be handled through fstab.
FYI, I "redirected" similar question to util-linux ML
http://article.gmane.org/gmane.linux.utilities.util-linux-ng/6967
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd-way for initialization zram swap

2012-11-19 Thread Lennart Poettering
On Mon, 19.11.12 22:47, Maksim 'max_posedon' Melnikau (maxpose...@gmail.com) 
wrote:

> # cat /etc/fstab | grep swap
> /dev/zram0swapswap
> sw,pri=1 0   0
> /dev/zram1swapswap
> sw,pri=1 0   0
> /dev/zram2swapswap
> sw,pri=1 0   0
> /dev/zram3swapswap
> sw,pri=1 0   0

If this is upstream in the kernel I think the nicest way to handle this
would be to extend util-linux to learn a new "zram" option or so we can
just add to the fstab lines, which sets up everything as needed. This
would then be similar to /dev/loop may be handled through fstab.

Karel, does that make sense to you?

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd-way for initialization zram swap

2012-11-19 Thread Oleksii Shevchuk
> 1. this service is kind of duplicating swap.target
> 2. echo inside duplicates things, which tmpfiles.d could do

Maybe. 

IMO semantically, you have new device, that should be configured
before use. It can appears after loading module. As for man 7 bootup,
there is no deps between early targets. So tmpfiles could start earlier
then zram device appears, and so on. I think separate service for device
configuration should be used anyway. 

> 3. service still based on some "internals" of swap.target - it doesn't
> do swaoff before ExecStop

I should add RefuseManualStart=/RefuseManualStop= to unit
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd-way for initialization zram swap

2012-11-19 Thread Maksim 'max_posedon' Melnikau
On Mon, Nov 19, 2012 at 11:16 PM, Oleksii Shevchuk  wrote:
> That's enough for me:
> # cat /etc/systemd/system/zram-swap\@.service
>...
This is exactly what I dislike a bit,

1. this service is kind of duplicating swap.target
2. echo inside duplicates things, which tmpfiles.d could do
3. service still based on some "internals" of swap.target - it doesn't
do swaoff before ExecStop ( I think swap.target do it for you )

I may be like to see, integration via fstab - via comment=, and
systemd special behavior on comment= oin swap targets
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd-way for initialization zram swap

2012-11-19 Thread Oleksii Shevchuk
That's enough for me:

# cat /etc/udev/rules.d/01-zram.rules 
KERNEL=="zram[0-9]", ENV{SYSTEMD_WANTS}="zram-swap@zram%n.service", 
TAG+="systemd"

# cat /etc/systemd/system/zram-swap\@.service 
[Unit]
Description=Setup swap on zram based device %i
BindsTo=dev-%i.swap
After=dev-%i.device
Requires=dev-%i.device
Before=dev-%i.swap
Wants=dev-%i.swap

[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=-/etc/conf.d/%i-size
ExecStart=-/bin/sh -c 'echo $SIZE > /sys/class/block/%i/disksize'
ExecStart=-/sbin/mkswap /dev/%i
ExecStop=-/bin/sh -c 'echo 1 > /sys/class/block/%i/reset'

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel