Re: [systemd-devel] [PATCH 2/2] core/swap.c: Do not add Before=swap.target to swap units.

2012-10-16 Thread Thomas Bächler
Am 16.10.2012 02:22, schrieb Lennart Poettering:
> On Sat, 06.10.12 01:11, Thomas Bächler (tho...@archlinux.org) wrote:
> 
>> The fstab generator adds Before=swap.target by default, and when creating
>> a custom .swap unit, you can also add Before=swap.target to the unit.
>>
>> However, it is impossible to not have this ordering dependency right now.
>> Virtually all existing setups likely use the fstab generator, so this
>> change is unlikely to break anything.
> 
> Thanks!
> 
> Seems for .mount units we don't generate target deps either in the core
> code either, hence we should make the handling of swap unit and mount
> units more similar.
> 
> Commited!
> 
> (It feels so good to commit a patch that just deletes code! ;-))

Thank you, this speeds up my boot process for another few nanoseconds or
so :)

I'd like to add this for completeness: Once you add the swap unit to
swap.target.wants, and have DefaultDependencies=yes, you also get
Before=swap.target implicitly. I realized this very late, as it is only
stated in the systemd.target manpage, but not in the description of
DefaultDependencies in systemd.unit.




signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 2/2] core/swap.c: Do not add Before=swap.target to swap units.

2012-10-15 Thread Lennart Poettering
On Sat, 06.10.12 01:11, Thomas Bächler (tho...@archlinux.org) wrote:

> The fstab generator adds Before=swap.target by default, and when creating
> a custom .swap unit, you can also add Before=swap.target to the unit.
> 
> However, it is impossible to not have this ordering dependency right now.
> Virtually all existing setups likely use the fstab generator, so this
> change is unlikely to break anything.

Thanks!

Seems for .mount units we don't generate target deps either in the core
code either, hence we should make the handling of swap unit and mount
units more similar.

Commited!

(It feels so good to commit a patch that just deletes code! ;-))

> ---
>  src/core/swap.c | 19 ---
>  1 file changed, 19 deletions(-)
> 
> diff --git a/src/core/swap.c b/src/core/swap.c
> index b4f53b7..c708b7f 100644
> --- a/src/core/swap.c
> +++ b/src/core/swap.c
> @@ -165,22 +165,6 @@ static int swap_add_mount_links(Swap *s) {
>  return 0;
>  }
>  
> -static int swap_add_target_links(Swap *s) {
> -Unit *tu;
> -int r;
> -
> -assert(s);
> -
> -if (!s->from_fragment)
> -return 0;
> -
> -r = manager_load_unit(UNIT(s)->manager, SPECIAL_SWAP_TARGET, NULL, 
> NULL, &tu);
> -if (r < 0)
> -return r;
> -
> -return unit_add_dependency(UNIT(s), UNIT_BEFORE, tu, true);
> -}
> -
>  static int swap_add_device_links(Swap *s) {
>  SwapParameters *p;
>  
> @@ -291,9 +275,6 @@ static int swap_load(Unit *u) {
>  if ((r = swap_add_mount_links(s)) < 0)
>  return r;
>  
> -if ((r = swap_add_target_links(s)) < 0)
> -return r;
> -
>  if ((r = unit_add_default_cgroups(u)) < 0)
>  return r;
>  


Lennart

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


[systemd-devel] [PATCH 2/2] core/swap.c: Do not add Before=swap.target to swap units.

2012-10-05 Thread Thomas Bächler
The fstab generator adds Before=swap.target by default, and when creating
a custom .swap unit, you can also add Before=swap.target to the unit.

However, it is impossible to not have this ordering dependency right now.
Virtually all existing setups likely use the fstab generator, so this
change is unlikely to break anything.

Signed-off-by: Thomas Bächler 
---
 src/core/swap.c | 19 ---
 1 file changed, 19 deletions(-)

diff --git a/src/core/swap.c b/src/core/swap.c
index b4f53b7..c708b7f 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -165,22 +165,6 @@ static int swap_add_mount_links(Swap *s) {
 return 0;
 }
 
-static int swap_add_target_links(Swap *s) {
-Unit *tu;
-int r;
-
-assert(s);
-
-if (!s->from_fragment)
-return 0;
-
-r = manager_load_unit(UNIT(s)->manager, SPECIAL_SWAP_TARGET, NULL, 
NULL, &tu);
-if (r < 0)
-return r;
-
-return unit_add_dependency(UNIT(s), UNIT_BEFORE, tu, true);
-}
-
 static int swap_add_device_links(Swap *s) {
 SwapParameters *p;
 
@@ -291,9 +275,6 @@ static int swap_load(Unit *u) {
 if ((r = swap_add_mount_links(s)) < 0)
 return r;
 
-if ((r = swap_add_target_links(s)) < 0)
-return r;
-
 if ((r = unit_add_default_cgroups(u)) < 0)
 return r;
 
-- 
1.7.12.2

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