chiark / gitweb /
readahead: avoid running of readahead services if readahead is already done
authorLennart Poettering <lennart@poettering.net>
Wed, 23 May 2012 01:51:25 +0000 (03:51 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 23 May 2012 01:51:25 +0000 (03:51 +0200)
src/readahead/sd-readahead.c
units/systemd-readahead-collect.service.in
units/systemd-readahead-replay.service.in

index a3340666dd7326f3bcd8e0f713c563867c474d7d..d48cd768079e74166f716283368ae7795765af72 100644 (file)
@@ -57,7 +57,8 @@ static int touch(const char *path) {
         mkdir("/run/systemd", 0755);
         mkdir("/run/systemd/readahead", 0755);
 
-        if ((fd = open(path, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY, 0666)) < 0)
+        fd = open(path, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY, 0666);
+        if (fd < 0)
                 return -errno;
 
         for (;;) {
index 7fe20d5c5c945c80a73c2e1a6f1b5a053391d55d..6ad286b290cb59abf244ee0397f4d0763dff5855 100644 (file)
@@ -11,6 +11,8 @@ DefaultDependencies=no
 Wants=systemd-readahead-done.timer
 Conflicts=shutdown.target
 Before=sysinit.target shutdown.target
+ConditionFileExists=!/run/systemd/readahead/cancel
+ConditionFileExists=!/run/systemd/readahead/done
 ConditionVirtualization=no
 
 [Service]
index 6a101678c308fe0c38a2f642ff976393e5299131..7324ba36c57553e723c40a19f38364344280aa78 100644 (file)
@@ -10,6 +10,7 @@ Description=Replay Read-Ahead Data
 DefaultDependencies=no
 Conflicts=shutdown.target
 Before=sysinit.target shutdown.target
+ConditionPathExists=!/run/systemd/readahead/noreplay
 ConditionPathExists=/.readahead
 ConditionVirtualization=no