Commit 881b96b7 authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov

ioping: call fadvise(RANDOM) for random I/O

This is just a hint, so print warning it fails.
Signed-off-by: default avatarKonstantin Khlebnikov <koct9i@gmail.com>
parent 36eadc07
......@@ -1146,13 +1146,17 @@ skip_preparation:
err(2, "failed to open \"%s\"", path);
}
if (!cached) {
/* No readahead for non-cached I/O, we'll invalidate it anyway */
if (randomize || !cached) {
#ifdef HAVE_POSIX_FADVICE
ret = posix_fadvise(fd, offset, wsize, POSIX_FADV_RANDOM);
if (ret)
err(2, "fadvise(RANDOM) failed, "
"please retry with option -C");
warn("fadvise(RANDOM) failed, "
"operations might perform unneeded readahead");
#endif
}
if (!cached) {
#ifdef HAVE_NOCACHE_IO
ret = fcntl(fd, F_NOCACHE, 1);
if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment