multiple paths exist between the client and the server or in certain loopback
configurations.
+.. option:: lstat=bool : [filestat]
+
+ Use lstat(2) to measure lookup/getattr performance. Default is 0.
+
.. option:: readfua=bool : [sg]
With readfua option set to 1, read operations include
#include <sys/stat.h>
#include <unistd.h>
#include "../fio.h"
+#include "../optgroup.h"
struct fc_data {
enum fio_ddir stat_ddir;
};
+struct filestat_options {
+ void *pad;
+ unsigned int lstat;
+};
+
+static struct fio_option options[] = {
+ {
+ .name = "lstat",
+ .lname = "lstat",
+ .type = FIO_OPT_BOOL,
+ .off1 = offsetof(struct filestat_options, lstat),
+ .help = "Use lstat(2) to measure lookup/getattr performance",
+ .def = "0",
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_FILESTAT,
+ },
+ {
+ .name = NULL,
+ },
+};
+
static int stat_file(struct thread_data *td, struct fio_file *f)
{
+ struct filestat_options *o = td->eo;
struct timespec start;
int do_lat = !td->o.disable_lat;
struct stat statbuf;
if (do_lat)
fio_gettime(&start, NULL);
- ret = stat(f->file_name, &statbuf);
+ if (o->lstat)
+ ret = lstat(f->file_name, &statbuf);
+ else
+ ret = stat(f->file_name, &statbuf);
if (ret == -1) {
char buf[FIO_VERROR_SIZE];
int e = errno;
- snprintf(buf, sizeof(buf), "stat(%s)", f->file_name);
+ snprintf(buf, sizeof(buf), "%sstat(%s)",
+ o->lstat ? "l" : "", f->file_name);
td_verror(td, e, buf);
return 1;
}
.open_file = stat_file,
.flags = FIO_SYNCIO | FIO_FAKEIO |
FIO_NOSTATS | FIO_NOFILEHASH,
+ .options = options,
+ .option_struct_size = sizeof(struct filestat_options),
};
static void fio_init fio_filestat_register(void)
function. This can be useful when multiple paths exist between the
client and the server or in certain loopback configurations.
.TP
+.BI (filestat)lstat \fR=\fPbool
+Use \fBlstat\fR\|(2) to measure lookup/getattr performance. Default: 0.
+.TP
.BI (sg)readfua \fR=\fPbool
With readfua option set to 1, read operations include the force
unit access (fua) flag. Default: 0.
__FIO_OPT_G_ISCSI,
__FIO_OPT_G_NBD,
__FIO_OPT_G_IOURING,
+ __FIO_OPT_G_FILESTAT,
__FIO_OPT_G_NR,
FIO_OPT_G_RATE = (1ULL << __FIO_OPT_G_RATE),
FIO_OPT_G_ISCSI = (1ULL << __FIO_OPT_G_ISCSI),
FIO_OPT_G_NBD = (1ULL << __FIO_OPT_G_NBD),
FIO_OPT_G_IOURING = (1ULL << __FIO_OPT_G_IOURING),
+ FIO_OPT_G_FILESTAT = (1ULL << __FIO_OPT_G_FILESTAT),
};
extern const struct opt_group *opt_group_from_mask(uint64_t *mask);