readahead: avoid running of readahead services if readahead is already done

This commit is contained in:
Lennart Poettering 2012-05-23 03:51:25 +02:00
parent e905f48fdc
commit 08231e5142
3 changed files with 5 additions and 1 deletions

View 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 (;;) {

View 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]

View 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