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;
any = true;
if (fd >= 0)
- if (readahead(fd, b * PAGE_SIZE, (c - b) * PAGE_SIZE) < 0) {
- log_warning("readahead() failed: %m");
+ if (posix_fadvise(fd, b * PAGE_SIZE, (c - b) * PAGE_SIZE, POSIX_FADV_WILLNEED) < 0) {
+ log_warning("posix_fadvise() failed: %m");
goto finish;
}
}
* intended to mean that the whole file shall be
* read */
- if (readahead(fd, 0, st.st_size) < 0) {
- log_warning("readahead() failed: %m");
+ if (posix_fadvise(fd, 0, st.st_size, POSIX_FADV_WILLNEED) < 0) {
+ log_warning("posix_fadvise() failed: %m");
goto finish;
}
}
}
static int replay(const char *root) {
- FILE *pack;
+ FILE *pack = NULL;
char line[LINE_MAX];
int r = 0;
char *pack_fn = NULL, c;
goto finish;
}
+ posix_fadvise(fileno(pack), 0, 0, POSIX_FADV_WILLNEED);
+
if ((inotify_fd = open_inotify()) < 0) {
r = inotify_fd;
goto finish;
return 0;
}
+ if (!(shared = shared_get()))
+ return 1;
+
+ shared->replay = getpid();
+ __sync_synchronize();
+
if (replay(optind < argc ? argv[optind] : "/") < 0)
return 1;