X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Freadahead%2Freadahead-replay.c;h=f91020e805fd44cc92ad2c446ea96d4965239183;hb=e677bf7ef610acdc5068b9d5d4c79556a236e52f;hp=65011ac4be3996d0ff41f92f44e889fdf3cb289a;hpb=e5e83e8362e946890ac991fc86a2c5869f9befdf;p=elogind.git diff --git a/src/readahead/readahead-replay.c b/src/readahead/readahead-replay.c index 65011ac4b..f91020e80 100644 --- a/src/readahead/readahead-replay.c +++ b/src/readahead/readahead-replay.c @@ -6,16 +6,16 @@ Copyright 2010 Lennart Poettering systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. systemd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with systemd; If not, see . ***/ @@ -35,10 +35,11 @@ #include #include +#include + #include "missing.h" #include "util.h" #include "set.h" -#include "sd-daemon.h" #include "ioprio.h" #include "readahead-common.h" #include "virt.h" @@ -185,7 +186,13 @@ static int replay(const char *root) { if (on_ssd) prio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0); else - prio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_RT, 7); + /* We are not using RT here, since we'd starve IO that + we didn't record (which is for example blkid, since + its disk accesses go directly to the block device and + are thus not visible in fallocate) to death. However, + we do ask for an IO prio that is slightly higher than + the default (which is BE. 4) */ + prio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, 2); if (ioprio_set(IOPRIO_WHO_PROCESS, getpid(), prio) < 0) log_warning("Failed to set IDLE IO priority class: %m"); @@ -337,13 +344,14 @@ int main(int argc, char*argv[]) { int r; const char *root; - log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); umask(0022); - if ((r = parse_argv(argc, argv)) <= 0) + r = parse_argv(argc, argv); + if (r <= 0) return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; root = optind < argc ? argv[optind] : "/"; @@ -353,12 +361,8 @@ int main(int argc, char*argv[]) { return 0; } - if (detect_virtualization(NULL) > 0) { - log_info("Disabling readahead replay due to execution in virtualized environment."); - return 0; - } - - if (!(shared = shared_get())) + shared = shared_get(); + if (!shared) return 1; shared->replay = getpid();