From 9b06a0b40cdab44246d814bdd24e22620a9a5b56 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 29 Sep 2011 23:00:11 +0200 Subject: [PATCH] readahead: read /usr files last for rotational media, skip /var --- src/readahead-collect.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/readahead-collect.c b/src/readahead-collect.c index eac11e7..ffa1dae 100644 --- a/src/readahead-collect.c +++ b/src/readahead-collect.c @@ -197,6 +197,7 @@ static unsigned long fd_first_block(int fd) { struct item { const char *path; unsigned long block; + int group; }; static int qsort_compare(const void *a, const void *b) { @@ -205,6 +206,11 @@ static int qsort_compare(const void *a, const void *b) { i = a; j = b; + if (i->group < j->group) + return -1; + if (i->group > j->group) + return 1; + if (i->block < j->block) return -1; if (i->block > j->block) @@ -418,6 +424,7 @@ static int collect(const char *root) { if ((k = readlink_malloc(fn, &p)) >= 0) { if (startswith(p, "/tmp") || + startswith(p, "/var") || endswith(p, " (deleted)") || hashmap_get(files, p)) /* Not interesting, or @@ -502,6 +509,7 @@ done: HASHMAP_FOREACH_KEY(q, p, files, i) { j->path = p; j->block = PTR_TO_SECTOR(q); + j->group = startswith(p, "/usr") ? 1 : 0; j++; } -- 1.7.6