summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-09-25 13:47:31 +0200
committerLennart Poettering <lennart@poettering.net>2010-09-25 13:47:31 +0200
commit902a339c93f44bc7290bede2f91f3a5c7cb16402 (patch)
tree4e79b1e483a9ad06282940f3ab439bf44e88a3cf
parent41a598e21a9f6cfe8dad7759c3c9facd55774acf (diff)
readahead-replay: delay ready notification until we queued first read
-rw-r--r--src/readahead-collect.c1
-rw-r--r--src/readahead-replay.c16
2 files changed, 13 insertions, 4 deletions
diff --git a/src/readahead-collect.c b/src/readahead-collect.c
index fe35da7004..6b9fb4650b 100644
--- a/src/readahead-collect.c
+++ b/src/readahead-collect.c
@@ -54,6 +54,7 @@
*
* - detect ssd/lvm/... on btrfs
* - read ahead directories
+ * - sd_readahead_cancel
*/
static int btrfs_defrag(int fd) {
diff --git a/src/readahead-replay.c b/src/readahead-replay.c
index 58d9468c43..c01f73e6a9 100644
--- a/src/readahead-replay.c
+++ b/src/readahead-replay.c
@@ -114,7 +114,7 @@ static int replay(const char *root) {
char line[LINE_MAX];
int r = 0;
char *pack_fn = NULL, c;
- bool on_ssd;
+ bool on_ssd, ready = false;
int prio;
assert(root);
@@ -168,9 +168,7 @@ static int replay(const char *root) {
if (ioprio_set(IOPRIO_WHO_PROCESS, getpid(), prio) < 0)
log_warning("Failed to set IDLE IO priority class: %m");
- sd_notify(0,
- "READY=1\n"
- "STATUS=Replaying readahead data");
+ sd_notify(0, "STATUS=Replaying readahead data");
log_debug("Replaying...");
@@ -181,8 +179,18 @@ static int replay(const char *root) {
r = k;
goto finish;
}
+
+ if (!ready) {
+ /* We delay the ready notification until we
+ * queued at least one read */
+ sd_notify(0, "READY=1");
+ ready = true;
+ }
}
+ if (!ready)
+ sd_notify(0, "READY=1");
+
if (ferror(pack)) {
log_error("Failed to read pack file.");
r = -EIO;