on what IO patterns it is likely to issue. Sometimes you
want to test specific IO patterns without telling the
kernel about it, in which case you can disable this option.
- If set, fio will use POSIX_FADV_SEQUENTIAL for sequential
- IO and POSIX_FADV_RANDOM for random IO.
+ The following options are supported:
+
+ sequential Use FADV_SEQUENTIAL
+ random Use FADV_RANDOM
+ 1 Backwards-compatible hint for basing
+ the hint on the fio workload. Will use
+ FADV_SEQUENTIAL for a sequential
+ workload, and FADV_RANDOM for a random
+ workload.
+ 0 Backwards-compatible setting for not
+ issing a fadvise hint.
fadvise_stream=int Notify the kernel what write stream ID to place these
writes under. Only supported on Linux. Note, this option
because ZFS doesn't support it. Default: 'posix'.
.RE
.TP
-.BI fadvise_hint \fR=\fPbool
+.BI fadvise_hint \fR=\fPstr
Use \fBposix_fadvise\fR\|(2) to advise the kernel what I/O patterns
-are likely to be issued. Default: true.
+are likely to be issued. Accepted values are:
+.RS
+.RS
+.TP
+.B 0
+Backwards compatible hint for "no hint".
+.TP
+.B 1
+Backwards compatible hint for "advise with fio workload type". This
+uses \fBFADV_RANDOM\fR for a random workload, and \fBFADV_SEQUENTIAL\fR
+for a sequential workload.
+.TP
+.B sequential
+Advise using \fBFADV_SEQUENTIAL\fR
+.TP
+.B random
+Advise using \fBFADV_RANDOM\fR
+.RE
+.RE
.TP
.BI fadvise_stream \fR=\fPint
Use \fBposix_fadvise\fR\|(2) to advise the kernel what stream ID the
RATE_PROCESS_POISSON = 1,
};
+enum {
+ F_ADV_NONE = 0,
+ F_ADV_TYPE,
+ F_ADV_RANDOM,
+ F_ADV_SEQUENTIAL,
+};
+
/*
* Per-thread/process specific data. Only used for the network client
* for now.
if (td->o.invalidate_cache && file_invalidate_cache(td, f))
goto err;
- if (td->o.fadvise_hint &&
+ if (td->o.fadvise_hint != F_ADV_NONE &&
(f->filetype == FIO_TYPE_BD || f->filetype == FIO_TYPE_FILE)) {
int flags;
- if (td_random(td))
+ if (td->o.fadvise_hint == F_ADV_TYPE) {
+ if (td_random(td))
+ flags = POSIX_FADV_RANDOM;
+ else
+ flags = POSIX_FADV_SEQUENTIAL;
+ } else if (td->o.fadvise_hint == F_ADV_RANDOM)
flags = POSIX_FADV_RANDOM;
- else
+ else if (td->o.fadvise_hint == F_ADV_SEQUENTIAL)
flags = POSIX_FADV_SEQUENTIAL;
+ else {
+ log_err("fio: unknown fadvise type %d\n",
+ td->o.fadvise_hint);
+ flags = POSIX_FADV_NORMAL;
+ }
if (posix_fadvise(f->fd, f->file_offset, f->io_size, flags) < 0) {
td_verror(td, errno, "fadvise");
{
.name = "fadvise_hint",
.lname = "Fadvise hint",
- .type = FIO_OPT_BOOL,
+ .type = FIO_OPT_STR,
.off1 = offsetof(struct thread_options, fadvise_hint),
+ .posval = {
+ { .ival = "0",
+ .oval = F_ADV_NONE,
+ .help = "Don't issue fadvise",
+ },
+ { .ival = "1",
+ .oval = F_ADV_TYPE,
+ .help = "Advise using fio IO pattern",
+ },
+ { .ival = "random",
+ .oval = F_ADV_RANDOM,
+ .help = "Advise using FADV_RANDOM",
+ },
+ { .ival = "sequential",
+ .oval = F_ADV_SEQUENTIAL,
+ .help = "Advise using FADV_SEQUENTIAL",
+ },
+ },
.help = "Use fadvise() to advise the kernel on IO pattern",
.def = "1",
.category = FIO_OPT_C_FILE,