chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cryptsetup: support non-LUKS crypto partitions
[elogind.git]
/
src
/
readahead-replay.c
diff --git
a/src/readahead-replay.c
b/src/readahead-replay.c
index 32941c144d5553dddcda4ca6dc7e88f04caf50b0..ab0c8084c8414c73daded01ca8664565d3937f8a 100644
(file)
--- a/
src/readahead-replay.c
+++ b/
src/readahead-replay.c
@@
-44,6
+44,8
@@
static off_t arg_file_size_max = READAHEAD_FILE_SIZE_MAX;
static off_t arg_file_size_max = READAHEAD_FILE_SIZE_MAX;
+static ReadaheadShared *shared = NULL;
+
static int unpack_file(FILE *pack) {
char fn[PATH_MAX];
int r = 0, fd = -1;
static int unpack_file(FILE *pack) {
char fn[PATH_MAX];
int r = 0, fd = -1;
@@
-114,7
+116,7
@@
finish:
}
static int replay(const char *root) {
}
static int replay(const char *root) {
- FILE *pack;
+ FILE *pack
= NULL
;
char line[LINE_MAX];
int r = 0;
char *pack_fn = NULL, c;
char line[LINE_MAX];
int r = 0;
char *pack_fn = NULL, c;
@@
-125,6
+127,7
@@
static int replay(const char *root) {
assert(root);
write_one_line_file("/proc/self/oom_score_adj", "1000");
assert(root);
write_one_line_file("/proc/self/oom_score_adj", "1000");
+ bump_request_nr(root);
if (asprintf(&pack_fn, "%s/.readahead", root) < 0) {
log_error("Out of memory");
if (asprintf(&pack_fn, "%s/.readahead", root) < 0) {
log_error("Out of memory");
@@
-143,6
+146,8
@@
static int replay(const char *root) {
goto finish;
}
goto finish;
}
+ posix_fadvise(fileno(pack), 0, 0, POSIX_FADV_WILLNEED);
+
if ((inotify_fd = open_inotify()) < 0) {
r = inotify_fd;
goto finish;
if ((inotify_fd = open_inotify()) < 0) {
r = inotify_fd;
goto finish;
@@
-338,6
+343,12
@@
int main(int argc, char*argv[]) {
return 0;
}
return 0;
}
+ if (!(shared = shared_get()))
+ return 1;
+
+ shared->replay = getpid();
+ __sync_synchronize();
+
if (replay(optind < argc ? argv[optind] : "/") < 0)
return 1;
if (replay(optind < argc ? argv[optind] : "/") < 0)
return 1;