chiark / gitweb /
mount: fix up wording in the comment
[elogind.git] / src / core / swap.c
index de3a5d8b10f1755c23a941bd5e3dae654f569398..6b1bdb5c1e49d283e43f8903becbb32c23d5e984 100644 (file)
@@ -506,7 +506,7 @@ static void swap_set_state(Swap *s, SwapState state) {
                         job_add_to_run_queue(UNIT(other)->job);
 }
 
-static int swap_coldplug(Unit *u) {
+static int swap_coldplug(Unit *u, Hashmap *deferred_work) {
         Swap *s = SWAP(u);
         SwapState new_state = SWAP_DEAD;
         int r;
@@ -604,7 +604,11 @@ static int swap_spawn(Swap *s, ExecCommand *c, pid_t *_pid) {
         assert(c);
         assert(_pid);
 
-        unit_realize_cgroup(UNIT(s));
+        (void) unit_realize_cgroup(UNIT(s));
+        if (s->reset_cpu_usage) {
+                (void) unit_reset_cpu_usage(UNIT(s));
+                s->reset_cpu_usage = false;
+        }
 
         r = unit_setup_exec_runtime(UNIT(s));
         if (r < 0)
@@ -720,8 +724,12 @@ static void swap_enter_activating(Swap *s) {
                                      NULL, &discard, NULL);
 
                 priority = s->parameters_fragment.priority;
-                if (priority < 0)
-                        fstab_find_pri(s->parameters_fragment.options, &priority);
+                if (priority < 0) {
+                        r = fstab_find_pri(s->parameters_fragment.options, &priority);
+                        if (r < 0)
+                                log_notice_errno(r, "Failed to parse swap priority \"%s\", ignoring: %m",
+                                                 s->parameters_fragment.options);
+                }
         }
 
         r = exec_command_set(s->control_command, "/sbin/swapon", NULL);
@@ -830,6 +838,8 @@ static int swap_start(Unit *u) {
                         return -EAGAIN;
 
         s->result = SWAP_SUCCESS;
+        s->reset_cpu_usage = true;
+
         swap_enter_activating(s);
         return 1;
 }