* [PATCH 01/15] Make return value type of fio_getaffinity() consistent
@ 2016-07-27 13:37 Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 02/15] Fix typos in log_err() message Tomohiro Kusumi
` (14 more replies)
0 siblings, 15 replies; 19+ messages in thread
From: Tomohiro Kusumi @ 2016-07-27 13:37 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
Return type of fio_getaffinity() isn't consistent among supported OS.
Windows and DragonFlyBSD return void while FreeBSD version is int.
The default version for those that don't support is do{}while(0).
Linux version is a macro for sched_getaffinity(2) which returns 0
on success and -1 otherwise, so others should basically follow that.
Note that I haven't compiled this on Windows, but it shouldn't fail.
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
---
os/os-dragonfly.h | 10 ++++++----
os/os-windows.h | 5 ++++-
os/os.h | 6 +++++-
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/os/os-dragonfly.h b/os/os-dragonfly.h
index 187330b..d4a9579 100644
--- a/os/os-dragonfly.h
+++ b/os/os-dragonfly.h
@@ -70,8 +70,7 @@ typedef cpumask_t os_cpu_mask_t;
/*
* Define USCHED_GET_CPUMASK as the macro didn't exist until release 4.5.
- * usched_set(2) returns EINVAL if the kernel doesn't support it, though
- * fio_getaffinity() returns void.
+ * usched_set(2) returns EINVAL if the kernel doesn't support it.
*
* Also note usched_set(2) works only for the current thread regardless of
* the command type. It doesn't work against another thread regardless of
@@ -145,12 +144,15 @@ static inline int fio_setaffinity(int pid, os_cpu_mask_t mask)
return 0;
}
-static inline void fio_getaffinity(int pid, os_cpu_mask_t *mask)
+static inline int fio_getaffinity(int pid, os_cpu_mask_t *mask)
{
/* 0 for the current thread, see BUGS in usched_set(2) */
pid = 0;
- usched_set(pid, USCHED_GET_CPUMASK, mask, sizeof(*mask));
+ if (usched_set(pid, USCHED_GET_CPUMASK, mask, sizeof(*mask)))
+ return -1;
+
+ return 0;
}
/* fio code is Linux based, so rename macros to Linux style */
diff --git a/os/os-windows.h b/os/os-windows.h
index d049531..616ad43 100644
--- a/os/os-windows.h
+++ b/os/os-windows.h
@@ -193,7 +193,7 @@ static inline int fio_setaffinity(int pid, os_cpu_mask_t cpumask)
return (bSuccess)? 0 : -1;
}
-static inline void fio_getaffinity(int pid, os_cpu_mask_t *mask)
+static inline int fio_getaffinity(int pid, os_cpu_mask_t *mask)
{
os_cpu_mask_t systemMask;
@@ -204,7 +204,10 @@ static inline void fio_getaffinity(int pid, os_cpu_mask_t *mask)
CloseHandle(h);
} else {
log_err("fio_getaffinity failed: failed to get handle for pid %d\n", pid);
+ return -1;
}
+
+ return 0;
}
static inline void fio_cpu_clear(os_cpu_mask_t *mask, int cpu)
diff --git a/os/os.h b/os/os.h
index 9877383..4f267c2 100644
--- a/os/os.h
+++ b/os/os.h
@@ -84,7 +84,6 @@ typedef struct aiocb os_aiocb_t;
#endif
#ifndef FIO_HAVE_CPU_AFFINITY
-#define fio_getaffinity(pid, mask) do { } while (0)
#define fio_cpu_clear(mask, cpu) do { } while (0)
typedef unsigned long os_cpu_mask_t;
@@ -93,6 +92,11 @@ static inline int fio_setaffinity(int pid, os_cpu_mask_t cpumask)
return 0;
}
+static inline int fio_getaffinity(int pid, os_cpu_mask_t *cpumask)
+{
+ return -1;
+}
+
static inline int fio_cpuset_exit(os_cpu_mask_t *mask)
{
return -1;
--
2.5.5
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 02/15] Fix typos in log_err() message
2016-07-27 13:37 [PATCH 01/15] Make return value type of fio_getaffinity() consistent Tomohiro Kusumi
@ 2016-07-27 13:37 ` Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 03/15] Use default CPU_COUNT() function in DragonFlyBSD Tomohiro Kusumi
` (13 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Tomohiro Kusumi @ 2016-07-27 13:37 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
---
filesetup.c | 2 +-
init.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/filesetup.c b/filesetup.c
index 012773b..d208a69 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -329,7 +329,7 @@ static int char_size(struct thread_data *td, struct fio_file *f)
int r;
if (td->io_ops->open_file(td, f)) {
- log_err("fio: failed opening blockdev %s for size check\n",
+ log_err("fio: failed opening chardev %s for size check\n",
f->file_name);
return 1;
}
diff --git a/init.c b/init.c
index 065a71a..47519bf 100644
--- a/init.c
+++ b/init.c
@@ -860,7 +860,7 @@ static int fixup_options(struct thread_data *td)
td->loops = 1;
if (td->o.block_error_hist && td->o.nr_files != 1) {
- log_err("fio: block error histogram only available with "
+ log_err("fio: block error histogram only available "
"with a single file per job, but %d files "
"provided\n", td->o.nr_files);
ret = 1;
--
2.5.5
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 03/15] Use default CPU_COUNT() function in DragonFlyBSD
2016-07-27 13:37 [PATCH 01/15] Make return value type of fio_getaffinity() consistent Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 02/15] Fix typos in log_err() message Tomohiro Kusumi
@ 2016-07-27 13:37 ` Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 04/15] Add FIO_HAVE_BLKDEV_INVALIDATE_CACHE to selectively support pagecache invalidation Tomohiro Kusumi
` (12 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Tomohiro Kusumi @ 2016-07-27 13:37 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
os/os.h has a default CPU_COUNT() inline function for those that
are expected to have CPU_COUNT() macro, but not in certain versions.
This seems to have been added for RHEL5 (or older?) and variants,
but use this in os/os-dragonfly.h since it's essentially the same
as its own fio_cpu_count() implementation.
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
---
os/os-dragonfly.h | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/os/os-dragonfly.h b/os/os-dragonfly.h
index d4a9579..c799817 100644
--- a/os/os-dragonfly.h
+++ b/os/os-dragonfly.h
@@ -81,6 +81,9 @@ typedef cpumask_t os_cpu_mask_t;
#define USCHED_GET_CPUMASK 5
#endif
+/* No CPU_COUNT(), but use the default function defined in os/os.h */
+#define fio_cpu_count(mask) CPU_COUNT((mask))
+
static inline int fio_cpuset_init(os_cpu_mask_t *mask)
{
CPUMASK_ASSZERO(*mask);
@@ -110,17 +113,6 @@ static inline int fio_cpu_isset(os_cpu_mask_t *mask, int cpu)
return 0;
}
-static inline int fio_cpu_count(os_cpu_mask_t *mask)
-{
- int i, n = 0;
-
- for (i = 0; i < FIO_MAX_CPUS; i++)
- if (CPUMASK_TESTBIT(*mask, i))
- n++;
-
- return n;
-}
-
static inline int fio_setaffinity(int pid, os_cpu_mask_t mask)
{
int i, firstcall = 1;
--
2.5.5
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 04/15] Add FIO_HAVE_BLKDEV_INVALIDATE_CACHE to selectively support pagecache invalidation
2016-07-27 13:37 [PATCH 01/15] Make return value type of fio_getaffinity() consistent Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 02/15] Fix typos in log_err() message Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 03/15] Use default CPU_COUNT() function in DragonFlyBSD Tomohiro Kusumi
@ 2016-07-27 13:37 ` Tomohiro Kusumi
2016-07-27 14:25 ` Jens Axboe
2016-07-27 13:37 ` [PATCH 05/15] Use sizeof(char*) instead of sizeof(void*) Tomohiro Kusumi
` (11 subsequent siblings)
14 siblings, 1 reply; 19+ messages in thread
From: Tomohiro Kusumi @ 2016-07-27 13:37 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
Most kernels either don't provide a way to invalidate the cache
or don't need to provide one as "block device" no longer exist
as a file type after being replaced by character device.
Linux (incl Android) is the only supported OS that actually does
something via ioctl.
This commit adds FIO_HAVE_BLKDEV_INVALIDATE_CACHE. If this macro
is undefined, cache invalidation for block device isn't supported.
Only Linux supports it as mentioned above. It's better to do this
like other OS specific features, because having blockdev_invalidate_cache()
implementation which only pretends as if it has invalidated cache
(by returning either 0 or EINVAL) could be misleading for users.
The drawback is this commit requires users to fix config files
(remove invalidate=) in order to use them on other platforms
that were portable till then.
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
---
HOWTO | 2 +-
fio.1 | 1 +
options.c | 9 +++++++++
os/os-aix.h | 5 -----
os/os-android.h | 1 +
os/os-dragonfly.h | 5 -----
os/os-freebsd.h | 5 -----
os/os-hpux.h | 5 -----
os/os-linux.h | 1 +
os/os-mac.h | 5 -----
os/os-netbsd.h | 5 -----
os/os-openbsd.h | 5 -----
os/os-solaris.h | 5 -----
os/os-windows.h | 7 -------
os/os.h | 7 +++++++
15 files changed, 20 insertions(+), 48 deletions(-)
diff --git a/HOWTO b/HOWTO
index ab25cb2..ca114a4 100644
--- a/HOWTO
+++ b/HOWTO
@@ -1211,7 +1211,7 @@ ramp_time=time If set, fio will run the specified workload for this amount
or runtime is specified.
invalidate=bool Invalidate the buffer/page cache parts for this file prior
- to starting io. Defaults to true.
+ to starting io. Defaults to true. Only supported on Linux.
sync=bool Use sync io for buffered writes. For the majority of the
io engines, this means using O_SYNC.
diff --git a/fio.1 b/fio.1
index e89c3d1..ac8e205 100644
--- a/fio.1
+++ b/fio.1
@@ -1138,6 +1138,7 @@ increase the total runtime if a special timeout or runtime is specified.
.TP
.BI invalidate \fR=\fPbool
Invalidate buffer-cache for the file prior to starting I/O. Default: true.
+Only supported on Linux.
.TP
.BI sync \fR=\fPbool
Use synchronous I/O for buffered writes. For the majority of I/O engines,
diff --git a/options.c b/options.c
index 4461643..df28a19 100644
--- a/options.c
+++ b/options.c
@@ -3214,6 +3214,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
.category = FIO_OPT_C_IO,
.group = FIO_OPT_G_LATPROF,
},
+#ifdef FIO_HAVE_BLKDEV_INVALIDATE_CACHE
{
.name = "invalidate",
.lname = "Cache invalidate",
@@ -3224,6 +3225,14 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
.category = FIO_OPT_C_IO,
.group = FIO_OPT_G_IO_TYPE,
},
+#else
+ {
+ .name = "invalidate",
+ .lname = "Cache invalidate",
+ .type = FIO_OPT_UNSUPPORTED,
+ .help = "Your platform does not support buffer/page cache invalidation",
+ },
+#endif
{
.name = "sync",
.lname = "Synchronous I/O",
diff --git a/os/os-aix.h b/os/os-aix.h
index 3d67765..ec9d4c2 100644
--- a/os/os-aix.h
+++ b/os/os-aix.h
@@ -21,11 +21,6 @@
#define FIO_USE_GENERIC_SWAP
-static inline int blockdev_invalidate_cache(struct fio_file *f)
-{
- return EINVAL;
-}
-
static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
{
struct devinfo info;
diff --git a/os/os-android.h b/os/os-android.h
index cdae703..0650137 100644
--- a/os/os-android.h
+++ b/os/os-android.h
@@ -27,6 +27,7 @@
#define FIO_HAVE_ODIRECT
#define FIO_HAVE_HUGETLB
#define FIO_HAVE_BLKTRACE
+#define FIO_HAVE_BLKDEV_INVALIDATE_CACHE
#define FIO_HAVE_PSHARED_MUTEX
#define FIO_HAVE_CL_SIZE
#define FIO_HAVE_FS_STAT
diff --git a/os/os-dragonfly.h b/os/os-dragonfly.h
index c799817..d2ec113 100644
--- a/os/os-dragonfly.h
+++ b/os/os-dragonfly.h
@@ -181,11 +181,6 @@ static inline int chardev_size(struct fio_file *f, unsigned long long *bytes)
return blockdev_size(f, bytes);
}
-static inline int blockdev_invalidate_cache(struct fio_file *f)
-{
- return EINVAL;
-}
-
static inline unsigned long long os_phys_mem(void)
{
int mib[2] = { CTL_HW, HW_PHYSMEM };
diff --git a/os/os-freebsd.h b/os/os-freebsd.h
index ac408c9..4a345fb 100644
--- a/os/os-freebsd.h
+++ b/os/os-freebsd.h
@@ -79,11 +79,6 @@ static inline int chardev_size(struct fio_file *f, unsigned long long *bytes)
return blockdev_size(f, bytes);
}
-static inline int blockdev_invalidate_cache(struct fio_file *f)
-{
- return EINVAL;
-}
-
static inline unsigned long long os_phys_mem(void)
{
int mib[2] = { CTL_HW, HW_PHYSMEM };
diff --git a/os/os-hpux.h b/os/os-hpux.h
index 82acd11..c1bc968 100644
--- a/os/os-hpux.h
+++ b/os/os-hpux.h
@@ -42,11 +42,6 @@
#define FIO_OS_HAVE_AIOCB_TYPEDEF
typedef struct aiocb64 os_aiocb_t;
-static inline int blockdev_invalidate_cache(struct fio_file *f)
-{
- return EINVAL;
-}
-
static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
{
disk_describe_type_ext_t dext;
diff --git a/os/os-linux.h b/os/os-linux.h
index 06235ab..129774a 100644
--- a/os/os-linux.h
+++ b/os/os-linux.h
@@ -32,6 +32,7 @@
#define FIO_HAVE_HUGETLB
#define FIO_HAVE_RAWBIND
#define FIO_HAVE_BLKTRACE
+#define FIO_HAVE_BLKDEV_INVALIDATE_CACHE
#define FIO_HAVE_PSHARED_MUTEX
#define FIO_HAVE_CL_SIZE
#define FIO_HAVE_CGROUPS
diff --git a/os/os-mac.h b/os/os-mac.h
index 76d388e..035bdc7 100644
--- a/os/os-mac.h
+++ b/os/os-mac.h
@@ -73,11 +73,6 @@ static inline int chardev_size(struct fio_file *f, unsigned long long *bytes)
return 0;
}
-static inline int blockdev_invalidate_cache(struct fio_file *f)
-{
- return EINVAL;
-}
-
static inline unsigned long long os_phys_mem(void)
{
int mib[2] = { CTL_HW, HW_PHYSMEM };
diff --git a/os/os-netbsd.h b/os/os-netbsd.h
index 4b0269e..71dd683 100644
--- a/os/os-netbsd.h
+++ b/os/os-netbsd.h
@@ -35,11 +35,6 @@
typedef off_t off64_t;
-static inline int blockdev_invalidate_cache(struct fio_file *f)
-{
- return EINVAL;
-}
-
static inline unsigned long long os_phys_mem(void)
{
int mib[2] = { CTL_HW, HW_PHYSMEM64 };
diff --git a/os/os-openbsd.h b/os/os-openbsd.h
index b1d8e83..5f8a3eb 100644
--- a/os/os-openbsd.h
+++ b/os/os-openbsd.h
@@ -33,11 +33,6 @@
typedef off_t off64_t;
-static inline int blockdev_invalidate_cache(struct fio_file *f)
-{
- return EINVAL;
-}
-
static inline unsigned long long os_phys_mem(void)
{
int mib[2] = { CTL_HW, HW_PHYSMEM64 };
diff --git a/os/os-solaris.h b/os/os-solaris.h
index 5b78cc2..1ac0b2e 100644
--- a/os/os-solaris.h
+++ b/os/os-solaris.h
@@ -59,11 +59,6 @@ static inline int chardev_size(struct fio_file *f, unsigned long long *bytes)
return 0;
}
-static inline int blockdev_invalidate_cache(struct fio_file *f)
-{
- return 0;
-}
-
static inline unsigned long long os_phys_mem(void)
{
return 0;
diff --git a/os/os-windows.h b/os/os-windows.h
index 616ad43..b388bad 100644
--- a/os/os-windows.h
+++ b/os/os-windows.h
@@ -150,13 +150,6 @@ static inline int chardev_size(struct fio_file *f, unsigned long long *bytes)
return blockdev_size(f, bytes);
}
-static inline int blockdev_invalidate_cache(struct fio_file *f)
-{
- /* There's no way to invalidate the cache in Windows
- * so just pretend to succeed */
- return 0;
-}
-
static inline unsigned long long os_phys_mem(void)
{
long pagesize, pages;
diff --git a/os/os.h b/os/os.h
index 4f267c2..b6fdfb2 100644
--- a/os/os.h
+++ b/os/os.h
@@ -265,6 +265,13 @@ static inline int load_blktrace(struct thread_data *td, const char *fname,
}
#endif
+#ifndef FIO_HAVE_BLKDEV_INVALIDATE_CACHE
+static inline int blockdev_invalidate_cache(struct fio_file *f)
+{
+ return 1; /* The caller cares if it's negative or not */
+}
+#endif
+
#define FIO_DEF_CL_SIZE 128
static inline int os_cache_line_size(void)
--
2.5.5
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 05/15] Use sizeof(char*) instead of sizeof(void*)
2016-07-27 13:37 [PATCH 01/15] Make return value type of fio_getaffinity() consistent Tomohiro Kusumi
` (2 preceding siblings ...)
2016-07-27 13:37 ` [PATCH 04/15] Add FIO_HAVE_BLKDEV_INVALIDATE_CACHE to selectively support pagecache invalidation Tomohiro Kusumi
@ 2016-07-27 13:37 ` Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 06/15] Mention default values for readwrite=/ioengine=/mem= in documentation Tomohiro Kusumi
` (10 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Tomohiro Kusumi @ 2016-07-27 13:37 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
Conform to the exact data type though both pointers are
normally expected to be the same size on various archs.
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
---
options.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/options.c b/options.c
index df28a19..db5912a 100644
--- a/options.c
+++ b/options.c
@@ -258,7 +258,7 @@ static int str2error(char *str)
"EINVAL", "ENFILE", "EMFILE", "ENOTTY",
"ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
"EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
- int i = 0, num = sizeof(err) / sizeof(void *);
+ int i = 0, num = sizeof(err) / sizeof(char *);
while (i < num) {
if (!strcmp(err[i], str))
--
2.5.5
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 06/15] Mention default values for readwrite=/ioengine=/mem= in documentation
2016-07-27 13:37 [PATCH 01/15] Make return value type of fio_getaffinity() consistent Tomohiro Kusumi
` (3 preceding siblings ...)
2016-07-27 13:37 ` [PATCH 05/15] Use sizeof(char*) instead of sizeof(void*) Tomohiro Kusumi
@ 2016-07-27 13:37 ` Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 07/15] Mention cpuio never finishes without real I/O " Tomohiro Kusumi
` (9 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Tomohiro Kusumi @ 2016-07-27 13:37 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
HOWTO/fio(1) mention defaults for many of the available options.
This commit adds defaults for the following options.
readwrite=
ioengine=
mem=
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
---
HOWTO | 6 +++++-
fio.1 | 6 ++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/HOWTO b/HOWTO
index ca114a4..7f25bbc 100644
--- a/HOWTO
+++ b/HOWTO
@@ -405,6 +405,7 @@ rw=str Type of io pattern. Accepted values are:
trimwrite Mixed trims and writes. Blocks will be
trimmed first, then written to.
+ Fio defaults to read if the option is not specified.
For the mixed io types, the default is to split them 50/50.
For certain types of io the result may still be skewed a bit,
since the speed may be different. It is possible to specify
@@ -699,7 +700,8 @@ ioengine=str Defines how the job issues io to the file. The following
sync Basic read(2) or write(2) io. lseek(2) is
used to position the io location.
- psync Basic pread(2) or pwrite(2) io.
+ psync Basic pread(2) or pwrite(2) io. Default on all
+ supported operating systems except for Windows.
vsync Basic readv(2) or writev(2) IO.
@@ -717,6 +719,7 @@ ioengine=str Defines how the job issues io to the file. The following
solarisaio Solaris native asynchronous io.
windowsaio Windows native asynchronous io.
+ Default on Windows.
mmap File is memory mapped and data copied
to/from using memcpy(3).
@@ -1221,6 +1224,7 @@ mem=str Fio can use various types of memory as the io unit buffer.
The allowed values are:
malloc Use memory from malloc(3) as the buffers.
+ Default memory type.
shm Use shared memory as the buffers. Allocated
through shmget(2).
diff --git a/fio.1 b/fio.1
index ac8e205..739d950 100644
--- a/fio.1
+++ b/fio.1
@@ -309,6 +309,7 @@ Trim and write mixed workload. Blocks will be trimmed first, then the same
blocks will be written to.
.RE
.P
+Fio defaults to read if the option is not specified.
For mixed I/O, the default split is 50/50. For certain types of io the result
may still be skewed a bit, since the speed may be different. It is possible to
specify a number of IO's to do before getting a new offset, this is done by
@@ -602,6 +603,7 @@ position the I/O location.
.TP
.B psync
Basic \fBpread\fR\|(2) or \fBpwrite\fR\|(2) I/O.
+Default on all supported operating systems except for Windows.
.TP
.B vsync
Basic \fBreadv\fR\|(2) or \fBwritev\fR\|(2) I/O. Will emulate queuing by
@@ -623,7 +625,7 @@ POSIX asynchronous I/O using \fBaio_read\fR\|(3) and \fBaio_write\fR\|(3).
Solaris native asynchronous I/O.
.TP
.B windowsaio
-Windows native asynchronous I/O.
+Windows native asynchronous I/O. Default on Windows.
.TP
.B mmap
File is memory mapped with \fBmmap\fR\|(2) and data copied using
@@ -1150,7 +1152,7 @@ Allocation method for I/O unit buffer. Allowed values are:
.RS
.TP
.B malloc
-Allocate memory with \fBmalloc\fR\|(3).
+Allocate memory with \fBmalloc\fR\|(3). Default memory type.
.TP
.B shm
Use shared memory buffers allocated through \fBshmget\fR\|(2).
--
2.5.5
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 07/15] Mention cpuio never finishes without real I/O in documentation
2016-07-27 13:37 [PATCH 01/15] Make return value type of fio_getaffinity() consistent Tomohiro Kusumi
` (4 preceding siblings ...)
2016-07-27 13:37 ` [PATCH 06/15] Mention default values for readwrite=/ioengine=/mem= in documentation Tomohiro Kusumi
@ 2016-07-27 13:37 ` Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 08/15] Ignore exit_io_done= option if no I/O threads are configured Tomohiro Kusumi
` (8 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Tomohiro Kusumi @ 2016-07-27 13:37 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
reap_threads() terminates cpuio threads only when there is
at least one real I/O thread that is exiting.
> if (*nr_running == cputhreads && !pending && realthreads)
> fio_terminate_threads(TERMINATE_ALL);
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
---
HOWTO | 3 ++-
fio.1 | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/HOWTO b/HOWTO
index 7f25bbc..cfcc81f 100644
--- a/HOWTO
+++ b/HOWTO
@@ -757,7 +757,8 @@ ioengine=str Defines how the job issues io to the file. The following
85% of the CPU. In case of SMP machines,
use numjobs=<no_of_cpu> to get desired CPU
usage, as the cpuload only loads a single
- CPU at the desired rate.
+ CPU at the desired rate. A job never finishes
+ unless there is at least one non-cpuio job.
guasi The GUASI IO engine is the Generic Userspace
Asyncronous Syscall Interface approach
diff --git a/fio.1 b/fio.1
index 739d950..cff95ee 100644
--- a/fio.1
+++ b/fio.1
@@ -656,7 +656,8 @@ and send/receive. This ioengine defines engine specific options.
.TP
.B cpuio
Doesn't transfer any data, but burns CPU cycles according to \fBcpuload\fR and
-\fBcpuchunks\fR parameters.
+\fBcpuchunks\fR parameters. A job never finishes unless there is at least one
+non-cpuio job.
.TP
.B guasi
The GUASI I/O engine is the Generic Userspace Asynchronous Syscall Interface
--
2.5.5
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 08/15] Ignore exit_io_done= option if no I/O threads are configured
2016-07-27 13:37 [PATCH 01/15] Make return value type of fio_getaffinity() consistent Tomohiro Kusumi
` (5 preceding siblings ...)
2016-07-27 13:37 ` [PATCH 07/15] Mention cpuio never finishes without real I/O " Tomohiro Kusumi
@ 2016-07-27 13:37 ` Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 09/15] Use correct I/O engine name "cpuio" instead of "cpu" Tomohiro Kusumi
` (7 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Tomohiro Kusumi @ 2016-07-27 13:37 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
The cpuio engine option exit_io_done= should be effective only if
there is at least one real I/O thread configured.
The existing fio_cpuio_queue() with exit_io_done= option enabled
lets cpuio threads exit even if cpuio threads are the only threads
configured.
Since this option is supposed to mean "exit when I/O threads are done",
cpuio threads exiting (but only after the first spin cycle is done)
when no threads have done any I/O is a bit confusing.
> [cpu] exit_on_io_done=bool Detect when IO threads are done, then exit.
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
---
libfio.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libfio.c b/libfio.c
index 55762d7..2586675 100644
--- a/libfio.c
+++ b/libfio.c
@@ -274,14 +274,18 @@ int fio_running_or_pending_io_threads(void)
{
struct thread_data *td;
int i;
+ int nr_io_threads = 0;
for_each_td(td, i) {
if (td->flags & TD_F_NOIO)
continue;
+ nr_io_threads++;
if (td->runstate < TD_EXITED)
return 1;
}
+ if (!nr_io_threads)
+ return -1; /* we only had cpuio threads to begin with */
return 0;
}
--
2.5.5
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 09/15] Use correct I/O engine name "cpuio" instead of "cpu"
2016-07-27 13:37 [PATCH 01/15] Make return value type of fio_getaffinity() consistent Tomohiro Kusumi
` (6 preceding siblings ...)
2016-07-27 13:37 ` [PATCH 08/15] Ignore exit_io_done= option if no I/O threads are configured Tomohiro Kusumi
@ 2016-07-27 13:37 ` Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 10/15] Add missing --cmdhelp type string for FIO_OPT_UNSUPPORTED Tomohiro Kusumi
` (6 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Tomohiro Kusumi @ 2016-07-27 13:37 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
"cpuio" is the name of the engine/option, though the filename is cpu.c.
# grep "ioengine =" engines/cpu.c -A1
static struct ioengine_ops ioengine = {
.name = "cpuio",
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
---
HOWTO | 6 +++---
engines/cpu.c | 4 ++--
fio.1 | 6 +++---
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/HOWTO b/HOWTO
index cfcc81f..bc69ab0 100644
--- a/HOWTO
+++ b/HOWTO
@@ -1840,12 +1840,12 @@ that defines them is selected.
[psyncv2] hipri Set RWF_HIPRI on IO, indicating to the kernel that
it's of higher priority than normal.
-[cpu] cpuload=int Attempt to use the specified percentage of CPU cycles.
+[cpuio] cpuload=int Attempt to use the specified percentage of CPU cycles.
-[cpu] cpuchunks=int Split the load into cycles of the given time. In
+[cpuio] cpuchunks=int Split the load into cycles of the given time. In
microseconds.
-[cpu] exit_on_io_done=bool Detect when IO threads are done, then exit.
+[cpuio] exit_on_io_done=bool Detect when IO threads are done, then exit.
[netsplice] hostname=str
[net] hostname=str The host name or IP address to use for TCP or UDP based IO.
diff --git a/engines/cpu.c b/engines/cpu.c
index 7643a8c..3d855e3 100644
--- a/engines/cpu.c
+++ b/engines/cpu.c
@@ -88,8 +88,8 @@ static int fio_cpuio_init(struct thread_data *td)
o->nr_files = o->open_files = 1;
- log_info("%s: ioengine=cpu, cpuload=%u, cpucycle=%u\n", td->o.name,
- co->cpuload, co->cpucycle);
+ log_info("%s: ioengine=%s, cpuload=%u, cpucycle=%u\n",
+ td->o.name, td->io_ops->name, co->cpuload, co->cpucycle);
return 0;
}
diff --git a/fio.1 b/fio.1
index cff95ee..8387cbd 100644
--- a/fio.1
+++ b/fio.1
@@ -1696,13 +1696,13 @@ Some parameters are only valid when a specific ioengine is in use. These are
used identically to normal parameters, with the caveat that when used on the
command line, they must come after the ioengine.
.TP
-.BI (cpu)cpuload \fR=\fPint
+.BI (cpuio)cpuload \fR=\fPint
Attempt to use the specified percentage of CPU cycles.
.TP
-.BI (cpu)cpuchunks \fR=\fPint
+.BI (cpuio)cpuchunks \fR=\fPint
Split the load into cycles of the given time. In microseconds.
.TP
-.BI (cpu)exit_on_io_done \fR=\fPbool
+.BI (cpuio)exit_on_io_done \fR=\fPbool
Detect when IO threads are done, then exit.
.TP
.BI (libaio)userspace_reap
--
2.5.5
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 10/15] Add missing --cmdhelp type string for FIO_OPT_UNSUPPORTED
2016-07-27 13:37 [PATCH 01/15] Make return value type of fio_getaffinity() consistent Tomohiro Kusumi
` (7 preceding siblings ...)
2016-07-27 13:37 ` [PATCH 09/15] Use correct I/O engine name "cpuio" instead of "cpu" Tomohiro Kusumi
@ 2016-07-27 13:37 ` Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 11/15] Don't malloc/memcpy ioengine_ops on td initialization Tomohiro Kusumi
` (5 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Tomohiro Kusumi @ 2016-07-27 13:37 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
Without "unsupported" at index 12 (FIO_OPT_UNSUPPORTED) of typehelp[],
unsupported commands print irrelevant binary at typehelp[12].
# fio --cmdhelp=numa_cpu_nodes
numa_cpu_nodes: Build fio with libnuma-dev(el) to enable this option
type: ÏÿF
default: no default
With this commit.
# fio --cmdhelp=numa_cpu_nodes
numa_cpu_nodes: Build fio with libnuma-dev(el) to enable this option
type: unsupported
default: no default
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
---
parse.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/parse.c b/parse.c
index bb16bc1..086f786 100644
--- a/parse.c
+++ b/parse.c
@@ -109,6 +109,7 @@ static void show_option_help(struct fio_option *o, int is_err)
"list of floating point values separated by ':' (opt=5.9:7.8)",
"no argument (opt)",
"deprecated",
+ "unsupported",
};
size_t (*logger)(const char *format, ...);
--
2.5.5
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 11/15] Don't malloc/memcpy ioengine_ops on td initialization
2016-07-27 13:37 [PATCH 01/15] Make return value type of fio_getaffinity() consistent Tomohiro Kusumi
` (8 preceding siblings ...)
2016-07-27 13:37 ` [PATCH 10/15] Add missing --cmdhelp type string for FIO_OPT_UNSUPPORTED Tomohiro Kusumi
@ 2016-07-27 13:37 ` Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 12/15] Fix stat(2) related bugs introduced by changes made for Windows Tomohiro Kusumi
` (4 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Tomohiro Kusumi @ 2016-07-27 13:37 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
The only reason load_ioengine() needs to malloc extra space for
struct ioengine_ops and memcpy from the original ops is because td
has per-thread/process ioengine private data which is a part of
this structure.
If data (and dlhandle) are separated from struct ioengine_ops,
load_ioengine() no longer needs to malloc, as the rest of structure
fields such as function pointers and string literal are static.
Td only needs a pointer to the original ops. Also avoid memcpying
a list_head from the original ops.
This commit moves/renames data and dlhandle to struct thread_data
as thread_data::io_ops_data and thread_data::io_ops_dlhandle.
engines/*.c which access ioengine private data by dereferencing
td->io_ops->... are modified accordingly, but nothing more than that.
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
---
engines/binject.c | 10 +++++-----
engines/e4defrag.c | 6 +++---
engines/glusterfs.c | 20 ++++++++++----------
engines/glusterfs_async.c | 8 ++++----
engines/glusterfs_sync.c | 4 ++--
engines/guasi.c | 12 ++++++------
engines/libaio.c | 14 +++++++-------
engines/libhdfs.c | 16 ++++++++--------
engines/net.c | 42 ++++++++++++++++++++---------------------
engines/null.c | 12 ++++++------
engines/posixaio.c | 10 +++++-----
engines/rbd.c | 16 ++++++++--------
engines/rdma.c | 48 +++++++++++++++++++++++------------------------
engines/sg.c | 16 ++++++++--------
engines/solarisaio.c | 12 ++++++------
engines/splice.c | 12 ++++++------
engines/sync.c | 20 ++++++++++----------
engines/windowsaio.c | 16 ++++++++--------
fio.h | 6 ++++++
ioengine.h | 2 --
ioengines.c | 17 ++++++-----------
21 files changed, 159 insertions(+), 160 deletions(-)
diff --git a/engines/binject.c b/engines/binject.c
index f8e83cd..7d20a3f 100644
--- a/engines/binject.c
+++ b/engines/binject.c
@@ -94,7 +94,7 @@ static int fio_binject_getevents(struct thread_data *td, unsigned int min,
unsigned int max,
const struct timespec fio_unused *t)
{
- struct binject_data *bd = td->io_ops->data;
+ struct binject_data *bd = td->io_ops_data;
int left = max, ret, r = 0, ev_index = 0;
void *buf = bd->cmds;
unsigned int i, events;
@@ -185,7 +185,7 @@ static int fio_binject_doio(struct thread_data *td, struct io_u *io_u)
static int fio_binject_prep(struct thread_data *td, struct io_u *io_u)
{
- struct binject_data *bd = td->io_ops->data;
+ struct binject_data *bd = td->io_ops_data;
struct b_user_cmd *buc = &io_u->buc;
struct binject_file *bf = FILE_ENG_DATA(io_u->file);
@@ -234,7 +234,7 @@ static int fio_binject_queue(struct thread_data *td, struct io_u *io_u)
static struct io_u *fio_binject_event(struct thread_data *td, int event)
{
- struct binject_data *bd = td->io_ops->data;
+ struct binject_data *bd = td->io_ops_data;
return bd->events[event];
}
@@ -376,7 +376,7 @@ err_close:
static void fio_binject_cleanup(struct thread_data *td)
{
- struct binject_data *bd = td->io_ops->data;
+ struct binject_data *bd = td->io_ops_data;
if (bd) {
free(bd->events);
@@ -406,7 +406,7 @@ static int fio_binject_init(struct thread_data *td)
bd->fd_flags = malloc(sizeof(int) * td->o.nr_files);
memset(bd->fd_flags, 0, sizeof(int) * td->o.nr_files);
- td->io_ops->data = bd;
+ td->io_ops_data = bd;
return 0;
}
diff --git a/engines/e4defrag.c b/engines/e4defrag.c
index c0667fe..c599c98 100644
--- a/engines/e4defrag.c
+++ b/engines/e4defrag.c
@@ -109,7 +109,7 @@ static int fio_e4defrag_init(struct thread_data *td)
goto err;
ed->bsz = stub.st_blksize;
- td->io_ops->data = ed;
+ td->io_ops_data = ed;
return 0;
err:
td_verror(td, errno, "io_queue_init");
@@ -120,7 +120,7 @@ err:
static void fio_e4defrag_cleanup(struct thread_data *td)
{
- struct e4defrag_data *ed = td->io_ops->data;
+ struct e4defrag_data *ed = td->io_ops_data;
if (ed) {
if (ed->donor_fd >= 0)
close(ed->donor_fd);
@@ -136,7 +136,7 @@ static int fio_e4defrag_queue(struct thread_data *td, struct io_u *io_u)
unsigned long long len;
struct move_extent me;
struct fio_file *f = io_u->file;
- struct e4defrag_data *ed = td->io_ops->data;
+ struct e4defrag_data *ed = td->io_ops_data;
struct e4defrag_options *o = td->eo;
fio_ro_check(td, io_u);
diff --git a/engines/glusterfs.c b/engines/glusterfs.c
index dec9fb5..2abc283 100644
--- a/engines/glusterfs.c
+++ b/engines/glusterfs.c
@@ -41,7 +41,7 @@ int fio_gf_setup(struct thread_data *td)
dprint(FD_IO, "fio setup\n");
- if (td->io_ops->data)
+ if (td->io_ops_data)
return 0;
g = malloc(sizeof(struct gf_data));
@@ -77,19 +77,19 @@ int fio_gf_setup(struct thread_data *td)
goto cleanup;
}
dprint(FD_FILE, "fio setup %p\n", g->fs);
- td->io_ops->data = g;
+ td->io_ops_data = g;
return 0;
cleanup:
if (g->fs)
glfs_fini(g->fs);
free(g);
- td->io_ops->data = NULL;
+ td->io_ops_data = NULL;
return r;
}
void fio_gf_cleanup(struct thread_data *td)
{
- struct gf_data *g = td->io_ops->data;
+ struct gf_data *g = td->io_ops_data;
if (g) {
if (g->aio_events)
@@ -99,7 +99,7 @@ void fio_gf_cleanup(struct thread_data *td)
if (g->fs)
glfs_fini(g->fs);
free(g);
- td->io_ops->data = NULL;
+ td->io_ops_data = NULL;
}
}
@@ -107,7 +107,7 @@ int fio_gf_get_file_size(struct thread_data *td, struct fio_file *f)
{
struct stat buf;
int ret;
- struct gf_data *g = td->io_ops->data;
+ struct gf_data *g = td->io_ops_data;
dprint(FD_FILE, "get file size %s\n", f->file_name);
@@ -135,7 +135,7 @@ int fio_gf_open_file(struct thread_data *td, struct fio_file *f)
int flags = 0;
int ret = 0;
- struct gf_data *g = td->io_ops->data;
+ struct gf_data *g = td->io_ops_data;
struct stat sb = { 0, };
if (td_write(td)) {
@@ -268,7 +268,7 @@ int fio_gf_open_file(struct thread_data *td, struct fio_file *f)
int fio_gf_close_file(struct thread_data *td, struct fio_file *f)
{
int ret = 0;
- struct gf_data *g = td->io_ops->data;
+ struct gf_data *g = td->io_ops_data;
dprint(FD_FILE, "fd close %s\n", f->file_name);
@@ -284,7 +284,7 @@ int fio_gf_close_file(struct thread_data *td, struct fio_file *f)
int fio_gf_unlink_file(struct thread_data *td, struct fio_file *f)
{
int ret = 0;
- struct gf_data *g = td->io_ops->data;
+ struct gf_data *g = td->io_ops_data;
dprint(FD_FILE, "fd unlink %s\n", f->file_name);
@@ -300,7 +300,7 @@ int fio_gf_unlink_file(struct thread_data *td, struct fio_file *f)
g->fd = NULL;
free(g);
}
- td->io_ops->data = NULL;
+ td->io_ops_data = NULL;
return ret;
}
diff --git a/engines/glusterfs_async.c b/engines/glusterfs_async.c
index 7c2c139..8e42a84 100644
--- a/engines/glusterfs_async.c
+++ b/engines/glusterfs_async.c
@@ -13,7 +13,7 @@ struct fio_gf_iou {
static struct io_u *fio_gf_event(struct thread_data *td, int event)
{
- struct gf_data *gf_data = td->io_ops->data;
+ struct gf_data *gf_data = td->io_ops_data;
dprint(FD_IO, "%s\n", __FUNCTION__);
return gf_data->aio_events[event];
@@ -22,7 +22,7 @@ static struct io_u *fio_gf_event(struct thread_data *td, int event)
static int fio_gf_getevents(struct thread_data *td, unsigned int min,
unsigned int max, const struct timespec *t)
{
- struct gf_data *g = td->io_ops->data;
+ struct gf_data *g = td->io_ops_data;
unsigned int events = 0;
struct io_u *io_u;
int i;
@@ -99,7 +99,7 @@ static void gf_async_cb(glfs_fd_t * fd, ssize_t ret, void *data)
static int fio_gf_async_queue(struct thread_data fio_unused * td,
struct io_u *io_u)
{
- struct gf_data *g = td->io_ops->data;
+ struct gf_data *g = td->io_ops_data;
int r;
dprint(FD_IO, "%s op %s\n", __FUNCTION__, io_ddir_name(io_u->ddir));
@@ -150,7 +150,7 @@ int fio_gf_async_setup(struct thread_data *td)
return r;
td->o.use_thread = 1;
- g = td->io_ops->data;
+ g = td->io_ops_data;
g->aio_events = calloc(td->o.iodepth, sizeof(struct io_u *));
if (!g->aio_events) {
r = -ENOMEM;
diff --git a/engines/glusterfs_sync.c b/engines/glusterfs_sync.c
index 6de4ee2..05e184c 100644
--- a/engines/glusterfs_sync.c
+++ b/engines/glusterfs_sync.c
@@ -11,7 +11,7 @@
static int fio_gf_prep(struct thread_data *td, struct io_u *io_u)
{
struct fio_file *f = io_u->file;
- struct gf_data *g = td->io_ops->data;
+ struct gf_data *g = td->io_ops_data;
dprint(FD_FILE, "fio prep\n");
@@ -31,7 +31,7 @@ static int fio_gf_prep(struct thread_data *td, struct io_u *io_u)
static int fio_gf_queue(struct thread_data *td, struct io_u *io_u)
{
- struct gf_data *g = td->io_ops->data;
+ struct gf_data *g = td->io_ops_data;
int ret = 0;
dprint(FD_FILE, "fio queue len %lu\n", io_u->xfer_buflen);
diff --git a/engines/guasi.c b/engines/guasi.c
index c586f09..eb12c89 100644
--- a/engines/guasi.c
+++ b/engines/guasi.c
@@ -50,7 +50,7 @@ static int fio_guasi_prep(struct thread_data fio_unused *td, struct io_u *io_u)
static struct io_u *fio_guasi_event(struct thread_data *td, int event)
{
- struct guasi_data *ld = td->io_ops->data;
+ struct guasi_data *ld = td->io_ops_data;
struct io_u *io_u;
struct guasi_reqinfo rinf;
@@ -82,7 +82,7 @@ static struct io_u *fio_guasi_event(struct thread_data *td, int event)
static int fio_guasi_getevents(struct thread_data *td, unsigned int min,
unsigned int max, const struct timespec *t)
{
- struct guasi_data *ld = td->io_ops->data;
+ struct guasi_data *ld = td->io_ops_data;
int n, r;
long timeo = -1;
@@ -115,7 +115,7 @@ static int fio_guasi_getevents(struct thread_data *td, unsigned int min,
static int fio_guasi_queue(struct thread_data *td, struct io_u *io_u)
{
- struct guasi_data *ld = td->io_ops->data;
+ struct guasi_data *ld = td->io_ops_data;
fio_ro_check(td, io_u);
@@ -148,7 +148,7 @@ static void fio_guasi_queued(struct thread_data *td, struct io_u **io_us, int nr
static int fio_guasi_commit(struct thread_data *td)
{
- struct guasi_data *ld = td->io_ops->data;
+ struct guasi_data *ld = td->io_ops_data;
int i;
struct io_u *io_u;
struct fio_file *f;
@@ -198,7 +198,7 @@ static int fio_guasi_cancel(struct thread_data fio_unused *td,
static void fio_guasi_cleanup(struct thread_data *td)
{
- struct guasi_data *ld = td->io_ops->data;
+ struct guasi_data *ld = td->io_ops_data;
int n;
GDBG_PRINT(("fio_guasi_cleanup(%p)\n", ld));
@@ -235,7 +235,7 @@ static int fio_guasi_init(struct thread_data *td)
ld->queued_nr = 0;
ld->reqs_nr = 0;
- td->io_ops->data = ld;
+ td->io_ops_data = ld;
GDBG_PRINT(("fio_guasi_init(): depth=%d -> %p\n", td->o.iodepth, ld));
return 0;
diff --git a/engines/libaio.c b/engines/libaio.c
index 9d562bb..e15c519 100644
--- a/engines/libaio.c
+++ b/engines/libaio.c
@@ -83,7 +83,7 @@ static int fio_libaio_prep(struct thread_data fio_unused *td, struct io_u *io_u)
static struct io_u *fio_libaio_event(struct thread_data *td, int event)
{
- struct libaio_data *ld = td->io_ops->data;
+ struct libaio_data *ld = td->io_ops_data;
struct io_event *ev;
struct io_u *io_u;
@@ -145,7 +145,7 @@ static int user_io_getevents(io_context_t aio_ctx, unsigned int max,
static int fio_libaio_getevents(struct thread_data *td, unsigned int min,
unsigned int max, const struct timespec *t)
{
- struct libaio_data *ld = td->io_ops->data;
+ struct libaio_data *ld = td->io_ops_data;
struct libaio_options *o = td->eo;
unsigned actual_min = td->o.iodepth_batch_complete_min == 0 ? 0 : min;
struct timespec __lt, *lt = NULL;
@@ -181,7 +181,7 @@ static int fio_libaio_getevents(struct thread_data *td, unsigned int min,
static int fio_libaio_queue(struct thread_data *td, struct io_u *io_u)
{
- struct libaio_data *ld = td->io_ops->data;
+ struct libaio_data *ld = td->io_ops_data;
fio_ro_check(td, io_u);
@@ -238,7 +238,7 @@ static void fio_libaio_queued(struct thread_data *td, struct io_u **io_us,
static int fio_libaio_commit(struct thread_data *td)
{
- struct libaio_data *ld = td->io_ops->data;
+ struct libaio_data *ld = td->io_ops_data;
struct iocb **iocbs;
struct io_u **io_us;
struct timeval tv;
@@ -308,14 +308,14 @@ static int fio_libaio_commit(struct thread_data *td)
static int fio_libaio_cancel(struct thread_data *td, struct io_u *io_u)
{
- struct libaio_data *ld = td->io_ops->data;
+ struct libaio_data *ld = td->io_ops_data;
return io_cancel(ld->aio_ctx, &io_u->iocb, ld->aio_events);
}
static void fio_libaio_cleanup(struct thread_data *td)
{
- struct libaio_data *ld = td->io_ops->data;
+ struct libaio_data *ld = td->io_ops_data;
if (ld) {
/*
@@ -363,7 +363,7 @@ static int fio_libaio_init(struct thread_data *td)
ld->iocbs = calloc(ld->entries, sizeof(struct iocb *));
ld->io_us = calloc(ld->entries, sizeof(struct io_u *));
- td->io_ops->data = ld;
+ td->io_ops_data = ld;
return 0;
}
diff --git a/engines/libhdfs.c b/engines/libhdfs.c
index faad3f8..fba17c4 100644
--- a/engines/libhdfs.c
+++ b/engines/libhdfs.c
@@ -119,7 +119,7 @@ static int get_chunck_name(char *dest, char *file_name, uint64_t chunk_id) {
static int fio_hdfsio_prep(struct thread_data *td, struct io_u *io_u)
{
struct hdfsio_options *options = td->eo;
- struct hdfsio_data *hd = td->io_ops->data;
+ struct hdfsio_data *hd = td->io_ops_data;
unsigned long f_id;
char fname[CHUNCK_NAME_LENGTH_MAX];
int open_flags;
@@ -163,7 +163,7 @@ static int fio_hdfsio_prep(struct thread_data *td, struct io_u *io_u)
static int fio_hdfsio_queue(struct thread_data *td, struct io_u *io_u)
{
- struct hdfsio_data *hd = td->io_ops->data;
+ struct hdfsio_data *hd = td->io_ops_data;
struct hdfsio_options *options = td->eo;
int ret;
unsigned long offset;
@@ -223,7 +223,7 @@ int fio_hdfsio_open_file(struct thread_data *td, struct fio_file *f)
int fio_hdfsio_close_file(struct thread_data *td, struct fio_file *f)
{
- struct hdfsio_data *hd = td->io_ops->data;
+ struct hdfsio_data *hd = td->io_ops_data;
if (hd->curr_file_id != -1) {
if ( hdfsCloseFile(hd->fs, hd->fp) == -1) {
@@ -238,7 +238,7 @@ int fio_hdfsio_close_file(struct thread_data *td, struct fio_file *f)
static int fio_hdfsio_init(struct thread_data *td)
{
struct hdfsio_options *options = td->eo;
- struct hdfsio_data *hd = td->io_ops->data;
+ struct hdfsio_data *hd = td->io_ops_data;
struct fio_file *f;
uint64_t j,k;
int i, failure = 0;
@@ -309,13 +309,13 @@ static int fio_hdfsio_setup(struct thread_data *td)
int i;
uint64_t file_size, total_file_size;
- if (!td->io_ops->data) {
+ if (!td->io_ops_data) {
hd = malloc(sizeof(*hd));
memset(hd, 0, sizeof(*hd));
hd->curr_file_id = -1;
- td->io_ops->data = hd;
+ td->io_ops_data = hd;
}
total_file_size = 0;
@@ -346,7 +346,7 @@ static int fio_hdfsio_setup(struct thread_data *td)
static int fio_hdfsio_io_u_init(struct thread_data *td, struct io_u *io_u)
{
- struct hdfsio_data *hd = td->io_ops->data;
+ struct hdfsio_data *hd = td->io_ops_data;
struct hdfsio_options *options = td->eo;
int failure;
struct hdfsBuilder *bld;
@@ -381,7 +381,7 @@ static int fio_hdfsio_io_u_init(struct thread_data *td, struct io_u *io_u)
static void fio_hdfsio_io_u_free(struct thread_data *td, struct io_u *io_u)
{
- struct hdfsio_data *hd = td->io_ops->data;
+ struct hdfsio_data *hd = td->io_ops_data;
if (hd->fs && hdfsDisconnect(hd->fs) < 0) {
log_err("hdfs: disconnect failed: %d\n", errno);
diff --git a/engines/net.c b/engines/net.c
index 9301ccf..f24efc1 100644
--- a/engines/net.c
+++ b/engines/net.c
@@ -374,7 +374,7 @@ static int splice_io_u(int fdin, int fdout, unsigned int len)
*/
static int splice_in(struct thread_data *td, struct io_u *io_u)
{
- struct netio_data *nd = td->io_ops->data;
+ struct netio_data *nd = td->io_ops_data;
return splice_io_u(io_u->file->fd, nd->pipes[1], io_u->xfer_buflen);
}
@@ -385,7 +385,7 @@ static int splice_in(struct thread_data *td, struct io_u *io_u)
static int splice_out(struct thread_data *td, struct io_u *io_u,
unsigned int len)
{
- struct netio_data *nd = td->io_ops->data;
+ struct netio_data *nd = td->io_ops_data;
return splice_io_u(nd->pipes[0], io_u->file->fd, len);
}
@@ -423,7 +423,7 @@ static int vmsplice_io_u(struct io_u *io_u, int fd, unsigned int len)
static int vmsplice_io_u_out(struct thread_data *td, struct io_u *io_u,
unsigned int len)
{
- struct netio_data *nd = td->io_ops->data;
+ struct netio_data *nd = td->io_ops_data;
return vmsplice_io_u(io_u, nd->pipes[0], len);
}
@@ -433,7 +433,7 @@ static int vmsplice_io_u_out(struct thread_data *td, struct io_u *io_u,
*/
static int vmsplice_io_u_in(struct thread_data *td, struct io_u *io_u)
{
- struct netio_data *nd = td->io_ops->data;
+ struct netio_data *nd = td->io_ops_data;
return vmsplice_io_u(io_u, nd->pipes[1], io_u->xfer_buflen);
}
@@ -524,7 +524,7 @@ static void verify_udp_seq(struct thread_data *td, struct netio_data *nd,
static int fio_netio_send(struct thread_data *td, struct io_u *io_u)
{
- struct netio_data *nd = td->io_ops->data;
+ struct netio_data *nd = td->io_ops_data;
struct netio_options *o = td->eo;
int ret, flags = 0;
@@ -587,7 +587,7 @@ static int is_close_msg(struct io_u *io_u, int len)
static int fio_netio_recv(struct thread_data *td, struct io_u *io_u)
{
- struct netio_data *nd = td->io_ops->data;
+ struct netio_data *nd = td->io_ops_data;
struct netio_options *o = td->eo;
int ret, flags = 0;
@@ -645,7 +645,7 @@ static int fio_netio_recv(struct thread_data *td, struct io_u *io_u)
static int __fio_netio_queue(struct thread_data *td, struct io_u *io_u,
enum fio_ddir ddir)
{
- struct netio_data *nd = td->io_ops->data;
+ struct netio_data *nd = td->io_ops_data;
struct netio_options *o = td->eo;
int ret;
@@ -711,7 +711,7 @@ static int fio_netio_queue(struct thread_data *td, struct io_u *io_u)
static int fio_netio_connect(struct thread_data *td, struct fio_file *f)
{
- struct netio_data *nd = td->io_ops->data;
+ struct netio_data *nd = td->io_ops_data;
struct netio_options *o = td->eo;
int type, domain;
@@ -826,7 +826,7 @@ static int fio_netio_connect(struct thread_data *td, struct fio_file *f)
static int fio_netio_accept(struct thread_data *td, struct fio_file *f)
{
- struct netio_data *nd = td->io_ops->data;
+ struct netio_data *nd = td->io_ops_data;
struct netio_options *o = td->eo;
socklen_t socklen;
int state;
@@ -878,7 +878,7 @@ err:
static void fio_netio_send_close(struct thread_data *td, struct fio_file *f)
{
- struct netio_data *nd = td->io_ops->data;
+ struct netio_data *nd = td->io_ops_data;
struct netio_options *o = td->eo;
struct udp_close_msg msg;
struct sockaddr *to;
@@ -913,7 +913,7 @@ static int fio_netio_close_file(struct thread_data *td, struct fio_file *f)
static int fio_netio_udp_recv_open(struct thread_data *td, struct fio_file *f)
{
- struct netio_data *nd = td->io_ops->data;
+ struct netio_data *nd = td->io_ops_data;
struct netio_options *o = td->eo;
struct udp_close_msg msg;
struct sockaddr *to;
@@ -947,7 +947,7 @@ static int fio_netio_udp_recv_open(struct thread_data *td, struct fio_file *f)
static int fio_netio_send_open(struct thread_data *td, struct fio_file *f)
{
- struct netio_data *nd = td->io_ops->data;
+ struct netio_data *nd = td->io_ops_data;
struct netio_options *o = td->eo;
struct udp_close_msg msg;
struct sockaddr *to;
@@ -1049,7 +1049,7 @@ static int fio_fill_addr(struct thread_data *td, const char *host, int af,
static int fio_netio_setup_connect_inet(struct thread_data *td,
const char *host, unsigned short port)
{
- struct netio_data *nd = td->io_ops->data;
+ struct netio_data *nd = td->io_ops_data;
struct netio_options *o = td->eo;
struct addrinfo *res = NULL;
void *dst, *src;
@@ -1099,7 +1099,7 @@ static int fio_netio_setup_connect_inet(struct thread_data *td,
static int fio_netio_setup_connect_unix(struct thread_data *td,
const char *path)
{
- struct netio_data *nd = td->io_ops->data;
+ struct netio_data *nd = td->io_ops_data;
struct sockaddr_un *soun = &nd->addr_un;
soun->sun_family = AF_UNIX;
@@ -1120,7 +1120,7 @@ static int fio_netio_setup_connect(struct thread_data *td)
static int fio_netio_setup_listen_unix(struct thread_data *td, const char *path)
{
- struct netio_data *nd = td->io_ops->data;
+ struct netio_data *nd = td->io_ops_data;
struct sockaddr_un *addr = &nd->addr_un;
mode_t mode;
int len, fd;
@@ -1153,7 +1153,7 @@ static int fio_netio_setup_listen_unix(struct thread_data *td, const char *path)
static int fio_netio_setup_listen_inet(struct thread_data *td, short port)
{
- struct netio_data *nd = td->io_ops->data;
+ struct netio_data *nd = td->io_ops_data;
struct netio_options *o = td->eo;
struct ip_mreq mr;
struct sockaddr_in sin;
@@ -1269,7 +1269,7 @@ static int fio_netio_setup_listen_inet(struct thread_data *td, short port)
static int fio_netio_setup_listen(struct thread_data *td)
{
- struct netio_data *nd = td->io_ops->data;
+ struct netio_data *nd = td->io_ops_data;
struct netio_options *o = td->eo;
int ret;
@@ -1344,7 +1344,7 @@ static int fio_netio_init(struct thread_data *td)
static void fio_netio_cleanup(struct thread_data *td)
{
- struct netio_data *nd = td->io_ops->data;
+ struct netio_data *nd = td->io_ops_data;
if (nd) {
if (nd->listenfd != -1)
@@ -1368,13 +1368,13 @@ static int fio_netio_setup(struct thread_data *td)
td->o.open_files++;
}
- if (!td->io_ops->data) {
+ if (!td->io_ops_data) {
nd = malloc(sizeof(*nd));;
memset(nd, 0, sizeof(*nd));
nd->listenfd = -1;
nd->pipes[0] = nd->pipes[1] = -1;
- td->io_ops->data = nd;
+ td->io_ops_data = nd;
}
return 0;
@@ -1392,7 +1392,7 @@ static int fio_netio_setup_splice(struct thread_data *td)
fio_netio_setup(td);
- nd = td->io_ops->data;
+ nd = td->io_ops_data;
if (nd) {
if (pipe(nd->pipes) < 0)
return 1;
diff --git a/engines/null.c b/engines/null.c
index 41d42e0..f7ba370 100644
--- a/engines/null.c
+++ b/engines/null.c
@@ -25,7 +25,7 @@ struct null_data {
static struct io_u *fio_null_event(struct thread_data *td, int event)
{
- struct null_data *nd = (struct null_data *) td->io_ops->data;
+ struct null_data *nd = (struct null_data *) td->io_ops_data;
return nd->io_us[event];
}
@@ -34,7 +34,7 @@ static int fio_null_getevents(struct thread_data *td, unsigned int min_events,
unsigned int fio_unused max,
const struct timespec fio_unused *t)
{
- struct null_data *nd = (struct null_data *) td->io_ops->data;
+ struct null_data *nd = (struct null_data *) td->io_ops_data;
int ret = 0;
if (min_events) {
@@ -47,7 +47,7 @@ static int fio_null_getevents(struct thread_data *td, unsigned int min_events,
static int fio_null_commit(struct thread_data *td)
{
- struct null_data *nd = (struct null_data *) td->io_ops->data;
+ struct null_data *nd = (struct null_data *) td->io_ops_data;
if (!nd->events) {
#ifndef FIO_EXTERNAL_ENGINE
@@ -62,7 +62,7 @@ static int fio_null_commit(struct thread_data *td)
static int fio_null_queue(struct thread_data *td, struct io_u *io_u)
{
- struct null_data *nd = (struct null_data *) td->io_ops->data;
+ struct null_data *nd = (struct null_data *) td->io_ops_data;
fio_ro_check(td, io_u);
@@ -83,7 +83,7 @@ static int fio_null_open(struct thread_data fio_unused *td,
static void fio_null_cleanup(struct thread_data *td)
{
- struct null_data *nd = (struct null_data *) td->io_ops->data;
+ struct null_data *nd = (struct null_data *) td->io_ops_data;
if (nd) {
free(nd->io_us);
@@ -103,7 +103,7 @@ static int fio_null_init(struct thread_data *td)
} else
td->io_ops->flags |= FIO_SYNCIO;
- td->io_ops->data = nd;
+ td->io_ops_data = nd;
return 0;
}
diff --git a/engines/posixaio.c b/engines/posixaio.c
index 29bcc5a..e5411b7 100644
--- a/engines/posixaio.c
+++ b/engines/posixaio.c
@@ -93,7 +93,7 @@ static int fio_posixaio_prep(struct thread_data fio_unused *td,
static int fio_posixaio_getevents(struct thread_data *td, unsigned int min,
unsigned int max, const struct timespec *t)
{
- struct posixaio_data *pd = td->io_ops->data;
+ struct posixaio_data *pd = td->io_ops_data;
os_aiocb_t *suspend_list[SUSPEND_ENTRIES];
struct timespec start;
int have_timeout = 0;
@@ -161,7 +161,7 @@ restart:
static struct io_u *fio_posixaio_event(struct thread_data *td, int event)
{
- struct posixaio_data *pd = td->io_ops->data;
+ struct posixaio_data *pd = td->io_ops_data;
return pd->aio_events[event];
}
@@ -169,7 +169,7 @@ static struct io_u *fio_posixaio_event(struct thread_data *td, int event)
static int fio_posixaio_queue(struct thread_data *td,
struct io_u *io_u)
{
- struct posixaio_data *pd = td->io_ops->data;
+ struct posixaio_data *pd = td->io_ops_data;
os_aiocb_t *aiocb = &io_u->aiocb;
int ret;
@@ -220,7 +220,7 @@ static int fio_posixaio_queue(struct thread_data *td,
static void fio_posixaio_cleanup(struct thread_data *td)
{
- struct posixaio_data *pd = td->io_ops->data;
+ struct posixaio_data *pd = td->io_ops_data;
if (pd) {
free(pd->aio_events);
@@ -236,7 +236,7 @@ static int fio_posixaio_init(struct thread_data *td)
pd->aio_events = malloc(td->o.iodepth * sizeof(struct io_u *));
memset(pd->aio_events, 0, td->o.iodepth * sizeof(struct io_u *));
- td->io_ops->data = pd;
+ td->io_ops_data = pd;
return 0;
}
diff --git a/engines/rbd.c b/engines/rbd.c
index 87ed360..2967a9f 100644
--- a/engines/rbd.c
+++ b/engines/rbd.c
@@ -91,7 +91,7 @@ static int _fio_setup_rbd_data(struct thread_data *td,
{
struct rbd_data *rbd;
- if (td->io_ops->data)
+ if (td->io_ops_data)
return 0;
rbd = calloc(1, sizeof(struct rbd_data));
@@ -118,7 +118,7 @@ failed:
static int _fio_rbd_connect(struct thread_data *td)
{
- struct rbd_data *rbd = td->io_ops->data;
+ struct rbd_data *rbd = td->io_ops_data;
struct rbd_options *o = td->eo;
int r;
@@ -226,7 +226,7 @@ static void _fio_rbd_finish_aiocb(rbd_completion_t comp, void *data)
static struct io_u *fio_rbd_event(struct thread_data *td, int event)
{
- struct rbd_data *rbd = td->io_ops->data;
+ struct rbd_data *rbd = td->io_ops_data;
return rbd->aio_events[event];
}
@@ -282,7 +282,7 @@ static int rbd_io_u_cmp(const void *p1, const void *p2)
static int rbd_iter_events(struct thread_data *td, unsigned int *events,
unsigned int min_evts, int wait)
{
- struct rbd_data *rbd = td->io_ops->data;
+ struct rbd_data *rbd = td->io_ops_data;
unsigned int this_events = 0;
struct io_u *io_u;
int i, sidx;
@@ -361,7 +361,7 @@ static int fio_rbd_getevents(struct thread_data *td, unsigned int min,
static int fio_rbd_queue(struct thread_data *td, struct io_u *io_u)
{
- struct rbd_data *rbd = td->io_ops->data;
+ struct rbd_data *rbd = td->io_ops_data;
struct fio_rbd_iou *fri = io_u->engine_data;
int r = -1;
@@ -439,7 +439,7 @@ failed:
static void fio_rbd_cleanup(struct thread_data *td)
{
- struct rbd_data *rbd = td->io_ops->data;
+ struct rbd_data *rbd = td->io_ops_data;
if (rbd) {
_fio_rbd_disconnect(rbd);
@@ -467,7 +467,7 @@ static int fio_rbd_setup(struct thread_data *td)
log_err("fio_setup_rbd_data failed.\n");
goto cleanup;
}
- td->io_ops->data = rbd;
+ td->io_ops_data = rbd;
/* librbd does not allow us to run first in the main thread and later
* in a fork child. It needs to be the same process context all the
@@ -526,7 +526,7 @@ static int fio_rbd_open(struct thread_data *td, struct fio_file *f)
static int fio_rbd_invalidate(struct thread_data *td, struct fio_file *f)
{
#if defined(CONFIG_RBD_INVAL)
- struct rbd_data *rbd = td->io_ops->data;
+ struct rbd_data *rbd = td->io_ops_data;
return rbd_invalidate_cache(rbd->image);
#else
diff --git a/engines/rdma.c b/engines/rdma.c
index 7fbfad9..fbe8434 100644
--- a/engines/rdma.c
+++ b/engines/rdma.c
@@ -191,7 +191,7 @@ struct rdmaio_data {
static int client_recv(struct thread_data *td, struct ibv_wc *wc)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
unsigned int max_bs;
if (wc->byte_len != sizeof(rd->recv_buf)) {
@@ -232,7 +232,7 @@ static int client_recv(struct thread_data *td, struct ibv_wc *wc)
static int server_recv(struct thread_data *td, struct ibv_wc *wc)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
unsigned int max_bs;
if (wc->wr_id == FIO_RDMA_MAX_IO_DEPTH) {
@@ -257,7 +257,7 @@ static int server_recv(struct thread_data *td, struct ibv_wc *wc)
static int cq_event_handler(struct thread_data *td, enum ibv_wc_opcode opcode)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
struct ibv_wc wc;
struct rdma_io_u_data *r_io_u_d;
int ret;
@@ -368,7 +368,7 @@ static int cq_event_handler(struct thread_data *td, enum ibv_wc_opcode opcode)
*/
static int rdma_poll_wait(struct thread_data *td, enum ibv_wc_opcode opcode)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
struct ibv_cq *ev_cq;
void *ev_ctx;
int ret;
@@ -405,7 +405,7 @@ again:
static int fio_rdmaio_setup_qp(struct thread_data *td)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
struct ibv_qp_init_attr init_attr;
int qp_depth = td->o.iodepth * 2; /* 2 times of io depth */
@@ -485,7 +485,7 @@ err1:
static int fio_rdmaio_setup_control_msg_buffers(struct thread_data *td)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
rd->recv_mr = ibv_reg_mr(rd->pd, &rd->recv_buf, sizeof(rd->recv_buf),
IBV_ACCESS_LOCAL_WRITE);
@@ -529,7 +529,7 @@ static int get_next_channel_event(struct thread_data *td,
struct rdma_event_channel *channel,
enum rdma_cm_event_type wait_event)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
struct rdma_cm_event *event;
int ret;
@@ -561,7 +561,7 @@ static int get_next_channel_event(struct thread_data *td,
static int fio_rdmaio_prep(struct thread_data *td, struct io_u *io_u)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
struct rdma_io_u_data *r_io_u_d;
r_io_u_d = io_u->engine_data;
@@ -604,7 +604,7 @@ static int fio_rdmaio_prep(struct thread_data *td, struct io_u *io_u)
static struct io_u *fio_rdmaio_event(struct thread_data *td, int event)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
struct io_u *io_u;
int i;
@@ -622,7 +622,7 @@ static struct io_u *fio_rdmaio_event(struct thread_data *td, int event)
static int fio_rdmaio_getevents(struct thread_data *td, unsigned int min,
unsigned int max, const struct timespec *t)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
enum ibv_wc_opcode comp_opcode;
struct ibv_cq *ev_cq;
void *ev_ctx;
@@ -684,7 +684,7 @@ again:
static int fio_rdmaio_send(struct thread_data *td, struct io_u **io_us,
unsigned int nr)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
struct ibv_send_wr *bad_wr;
#if 0
enum ibv_wc_opcode comp_opcode;
@@ -747,7 +747,7 @@ static int fio_rdmaio_send(struct thread_data *td, struct io_u **io_us,
static int fio_rdmaio_recv(struct thread_data *td, struct io_u **io_us,
unsigned int nr)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
struct ibv_recv_wr *bad_wr;
struct rdma_io_u_data *r_io_u_d;
int i;
@@ -783,7 +783,7 @@ static int fio_rdmaio_recv(struct thread_data *td, struct io_u **io_us,
static int fio_rdmaio_queue(struct thread_data *td, struct io_u *io_u)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
fio_ro_check(td, io_u);
@@ -801,7 +801,7 @@ static int fio_rdmaio_queue(struct thread_data *td, struct io_u *io_u)
static void fio_rdmaio_queued(struct thread_data *td, struct io_u **io_us,
unsigned int nr)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
struct timeval now;
unsigned int i;
@@ -824,7 +824,7 @@ static void fio_rdmaio_queued(struct thread_data *td, struct io_u **io_us,
static int fio_rdmaio_commit(struct thread_data *td)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
struct io_u **io_us;
int ret;
@@ -856,7 +856,7 @@ static int fio_rdmaio_commit(struct thread_data *td)
static int fio_rdmaio_connect(struct thread_data *td, struct fio_file *f)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
struct rdma_conn_param conn_param;
struct ibv_send_wr *bad_wr;
@@ -907,7 +907,7 @@ static int fio_rdmaio_connect(struct thread_data *td, struct fio_file *f)
static int fio_rdmaio_accept(struct thread_data *td, struct fio_file *f)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
struct rdma_conn_param conn_param;
struct ibv_send_wr *bad_wr;
int ret = 0;
@@ -952,7 +952,7 @@ static int fio_rdmaio_open_file(struct thread_data *td, struct fio_file *f)
static int fio_rdmaio_close_file(struct thread_data *td, struct fio_file *f)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
struct ibv_send_wr *bad_wr;
/* unregister rdma buffer */
@@ -1008,7 +1008,7 @@ static int fio_rdmaio_close_file(struct thread_data *td, struct fio_file *f)
static int fio_rdmaio_setup_connect(struct thread_data *td, const char *host,
unsigned short port)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
struct ibv_recv_wr *bad_wr;
int err;
@@ -1072,7 +1072,7 @@ static int fio_rdmaio_setup_connect(struct thread_data *td, const char *host,
static int fio_rdmaio_setup_listen(struct thread_data *td, short port)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
struct ibv_recv_wr *bad_wr;
int state = td->runstate;
@@ -1207,7 +1207,7 @@ bad_host:
static int fio_rdmaio_init(struct thread_data *td)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
struct rdmaio_options *o = td->eo;
unsigned int max_bs;
int ret, i;
@@ -1316,7 +1316,7 @@ static int fio_rdmaio_init(struct thread_data *td)
static void fio_rdmaio_cleanup(struct thread_data *td)
{
- struct rdmaio_data *rd = td->io_ops->data;
+ struct rdmaio_data *rd = td->io_ops_data;
if (rd)
free(rd);
@@ -1332,12 +1332,12 @@ static int fio_rdmaio_setup(struct thread_data *td)
td->o.open_files++;
}
- if (!td->io_ops->data) {
+ if (!td->io_ops_data) {
rd = malloc(sizeof(*rd));
memset(rd, 0, sizeof(*rd));
init_rand_seed(&rd->rand_state, (unsigned int) GOLDEN_RATIO_PRIME, 0);
- td->io_ops->data = rd;
+ td->io_ops_data = rd;
}
return 0;
diff --git a/engines/sg.c b/engines/sg.c
index 360775f..c1fe602 100644
--- a/engines/sg.c
+++ b/engines/sg.c
@@ -102,7 +102,7 @@ static int fio_sgio_getevents(struct thread_data *td, unsigned int min,
unsigned int max,
const struct timespec fio_unused *t)
{
- struct sgio_data *sd = td->io_ops->data;
+ struct sgio_data *sd = td->io_ops_data;
int left = max, eventNum, ret, r = 0;
void *buf = sd->sgbuf;
unsigned int i, events;
@@ -207,7 +207,7 @@ re_read:
static int fio_sgio_ioctl_doio(struct thread_data *td,
struct fio_file *f, struct io_u *io_u)
{
- struct sgio_data *sd = td->io_ops->data;
+ struct sgio_data *sd = td->io_ops_data;
struct sg_io_hdr *hdr = &io_u->hdr;
int ret;
@@ -268,7 +268,7 @@ static int fio_sgio_doio(struct thread_data *td, struct io_u *io_u, int do_sync)
static int fio_sgio_prep(struct thread_data *td, struct io_u *io_u)
{
struct sg_io_hdr *hdr = &io_u->hdr;
- struct sgio_data *sd = td->io_ops->data;
+ struct sgio_data *sd = td->io_ops_data;
long long nr_blocks, lba;
if (io_u->xfer_buflen & (sd->bs - 1)) {
@@ -366,7 +366,7 @@ static int fio_sgio_queue(struct thread_data *td, struct io_u *io_u)
static struct io_u *fio_sgio_event(struct thread_data *td, int event)
{
- struct sgio_data *sd = td->io_ops->data;
+ struct sgio_data *sd = td->io_ops_data;
return sd->events[event];
}
@@ -463,7 +463,7 @@ static int fio_sgio_read_capacity(struct thread_data *td, unsigned int *bs,
static void fio_sgio_cleanup(struct thread_data *td)
{
- struct sgio_data *sd = td->io_ops->data;
+ struct sgio_data *sd = td->io_ops_data;
if (sd) {
free(sd->events);
@@ -492,7 +492,7 @@ static int fio_sgio_init(struct thread_data *td)
sd->sgbuf = malloc(sizeof(struct sg_io_hdr) * td->o.iodepth);
memset(sd->sgbuf, 0, sizeof(struct sg_io_hdr) * td->o.iodepth);
sd->type_checked = 0;
- td->io_ops->data = sd;
+ td->io_ops_data = sd;
/*
* we want to do it, regardless of whether odirect is set or not
@@ -503,7 +503,7 @@ static int fio_sgio_init(struct thread_data *td)
static int fio_sgio_type_check(struct thread_data *td, struct fio_file *f)
{
- struct sgio_data *sd = td->io_ops->data;
+ struct sgio_data *sd = td->io_ops_data;
unsigned int bs = 0;
unsigned long long max_lba = 0;
@@ -552,7 +552,7 @@ static int fio_sgio_type_check(struct thread_data *td, struct fio_file *f)
static int fio_sgio_open(struct thread_data *td, struct fio_file *f)
{
- struct sgio_data *sd = td->io_ops->data;
+ struct sgio_data *sd = td->io_ops_data;
int ret;
ret = generic_open_file(td, f);
diff --git a/engines/solarisaio.c b/engines/solarisaio.c
index 55a0cb9..151f31d 100644
--- a/engines/solarisaio.c
+++ b/engines/solarisaio.c
@@ -28,7 +28,7 @@ static int fio_solarisaio_cancel(struct thread_data fio_unused *td,
static int fio_solarisaio_prep(struct thread_data fio_unused *td,
struct io_u *io_u)
{
- struct solarisaio_data *sd = td->io_ops->data;
+ struct solarisaio_data *sd = td->io_ops_data;
io_u->resultp.aio_return = AIO_INPROGRESS;
io_u->engine_data = sd;
@@ -75,7 +75,7 @@ static void wait_for_event(struct timeval *tv)
static int fio_solarisaio_getevents(struct thread_data *td, unsigned int min,
unsigned int max, const struct timespec *t)
{
- struct solarisaio_data *sd = td->io_ops->data;
+ struct solarisaio_data *sd = td->io_ops_data;
struct timeval tv;
int ret;
@@ -100,7 +100,7 @@ static int fio_solarisaio_getevents(struct thread_data *td, unsigned int min,
static struct io_u *fio_solarisaio_event(struct thread_data *td, int event)
{
- struct solarisaio_data *sd = td->io_ops->data;
+ struct solarisaio_data *sd = td->io_ops_data;
return sd->aio_events[event];
}
@@ -108,7 +108,7 @@ static struct io_u *fio_solarisaio_event(struct thread_data *td, int event)
static int fio_solarisaio_queue(struct thread_data fio_unused *td,
struct io_u *io_u)
{
- struct solarisaio_data *sd = td->io_ops->data;
+ struct solarisaio_data *sd = td->io_ops_data;
struct fio_file *f = io_u->file;
off_t off;
int ret;
@@ -155,7 +155,7 @@ static int fio_solarisaio_queue(struct thread_data fio_unused *td,
static void fio_solarisaio_cleanup(struct thread_data *td)
{
- struct solarisaio_data *sd = td->io_ops->data;
+ struct solarisaio_data *sd = td->io_ops_data;
if (sd) {
free(sd->aio_events);
@@ -204,7 +204,7 @@ static int fio_solarisaio_init(struct thread_data *td)
fio_solarisaio_init_sigio();
#endif
- td->io_ops->data = sd;
+ td->io_ops_data = sd;
return 0;
}
diff --git a/engines/splice.c b/engines/splice.c
index f35ae17..eba093e 100644
--- a/engines/splice.c
+++ b/engines/splice.c
@@ -28,7 +28,7 @@ struct spliceio_data {
*/
static int fio_splice_read_old(struct thread_data *td, struct io_u *io_u)
{
- struct spliceio_data *sd = td->io_ops->data;
+ struct spliceio_data *sd = td->io_ops_data;
struct fio_file *f = io_u->file;
int ret, ret2, buflen;
off_t offset;
@@ -72,7 +72,7 @@ static int fio_splice_read_old(struct thread_data *td, struct io_u *io_u)
*/
static int fio_splice_read(struct thread_data *td, struct io_u *io_u)
{
- struct spliceio_data *sd = td->io_ops->data;
+ struct spliceio_data *sd = td->io_ops_data;
struct fio_file *f = io_u->file;
struct iovec iov;
int ret , buflen, mmap_len;
@@ -166,7 +166,7 @@ static int fio_splice_read(struct thread_data *td, struct io_u *io_u)
*/
static int fio_splice_write(struct thread_data *td, struct io_u *io_u)
{
- struct spliceio_data *sd = td->io_ops->data;
+ struct spliceio_data *sd = td->io_ops_data;
struct iovec iov = {
.iov_base = io_u->xfer_buf,
.iov_len = io_u->xfer_buflen,
@@ -201,7 +201,7 @@ static int fio_splice_write(struct thread_data *td, struct io_u *io_u)
static int fio_spliceio_queue(struct thread_data *td, struct io_u *io_u)
{
- struct spliceio_data *sd = td->io_ops->data;
+ struct spliceio_data *sd = td->io_ops_data;
int ret = 0;
fio_ro_check(td, io_u);
@@ -247,7 +247,7 @@ static int fio_spliceio_queue(struct thread_data *td, struct io_u *io_u)
static void fio_spliceio_cleanup(struct thread_data *td)
{
- struct spliceio_data *sd = td->io_ops->data;
+ struct spliceio_data *sd = td->io_ops_data;
if (sd) {
close(sd->pipe[0]);
@@ -284,7 +284,7 @@ static int fio_spliceio_init(struct thread_data *td)
if (td_read(td))
td->o.mem_align = 1;
- td->io_ops->data = sd;
+ td->io_ops_data = sd;
return 0;
}
diff --git a/engines/sync.c b/engines/sync.c
index 433e4fa..1726b8e 100644
--- a/engines/sync.c
+++ b/engines/sync.c
@@ -97,7 +97,7 @@ static int fio_io_end(struct thread_data *td, struct io_u *io_u, int ret)
#ifdef CONFIG_PWRITEV
static int fio_pvsyncio_queue(struct thread_data *td, struct io_u *io_u)
{
- struct syncio_data *sd = td->io_ops->data;
+ struct syncio_data *sd = td->io_ops_data;
struct iovec *iov = &sd->iovecs[0];
struct fio_file *f = io_u->file;
int ret;
@@ -124,7 +124,7 @@ static int fio_pvsyncio_queue(struct thread_data *td, struct io_u *io_u)
#ifdef FIO_HAVE_PWRITEV2
static int fio_pvsyncio2_queue(struct thread_data *td, struct io_u *io_u)
{
- struct syncio_data *sd = td->io_ops->data;
+ struct syncio_data *sd = td->io_ops_data;
struct psyncv2_options *o = td->eo;
struct iovec *iov = &sd->iovecs[0];
struct fio_file *f = io_u->file;
@@ -197,7 +197,7 @@ static int fio_vsyncio_getevents(struct thread_data *td, unsigned int min,
unsigned int max,
const struct timespec fio_unused *t)
{
- struct syncio_data *sd = td->io_ops->data;
+ struct syncio_data *sd = td->io_ops_data;
int ret;
if (min) {
@@ -212,14 +212,14 @@ static int fio_vsyncio_getevents(struct thread_data *td, unsigned int min,
static struct io_u *fio_vsyncio_event(struct thread_data *td, int event)
{
- struct syncio_data *sd = td->io_ops->data;
+ struct syncio_data *sd = td->io_ops_data;
return sd->io_us[event];
}
static int fio_vsyncio_append(struct thread_data *td, struct io_u *io_u)
{
- struct syncio_data *sd = td->io_ops->data;
+ struct syncio_data *sd = td->io_ops_data;
if (ddir_sync(io_u->ddir))
return 0;
@@ -246,7 +246,7 @@ static void fio_vsyncio_set_iov(struct syncio_data *sd, struct io_u *io_u,
static int fio_vsyncio_queue(struct thread_data *td, struct io_u *io_u)
{
- struct syncio_data *sd = td->io_ops->data;
+ struct syncio_data *sd = td->io_ops_data;
fio_ro_check(td, io_u);
@@ -286,7 +286,7 @@ static int fio_vsyncio_queue(struct thread_data *td, struct io_u *io_u)
*/
static int fio_vsyncio_end(struct thread_data *td, ssize_t bytes)
{
- struct syncio_data *sd = td->io_ops->data;
+ struct syncio_data *sd = td->io_ops_data;
struct io_u *io_u;
unsigned int i;
int err;
@@ -326,7 +326,7 @@ static int fio_vsyncio_end(struct thread_data *td, ssize_t bytes)
static int fio_vsyncio_commit(struct thread_data *td)
{
- struct syncio_data *sd = td->io_ops->data;
+ struct syncio_data *sd = td->io_ops_data;
struct fio_file *f;
ssize_t ret;
@@ -364,13 +364,13 @@ static int fio_vsyncio_init(struct thread_data *td)
sd->iovecs = malloc(td->o.iodepth * sizeof(struct iovec));
sd->io_us = malloc(td->o.iodepth * sizeof(struct io_u *));
- td->io_ops->data = sd;
+ td->io_ops_data = sd;
return 0;
}
static void fio_vsyncio_cleanup(struct thread_data *td)
{
- struct syncio_data *sd = td->io_ops->data;
+ struct syncio_data *sd = td->io_ops_data;
if (sd) {
free(sd->iovecs);
diff --git a/engines/windowsaio.c b/engines/windowsaio.c
index cbbed6a..0e164b6 100644
--- a/engines/windowsaio.c
+++ b/engines/windowsaio.c
@@ -84,7 +84,7 @@ static int fio_windowsaio_init(struct thread_data *td)
}
}
- td->io_ops->data = wd;
+ td->io_ops_data = wd;
if (!rc) {
struct thread_ctx *ctx;
@@ -97,7 +97,7 @@ static int fio_windowsaio_init(struct thread_data *td)
rc = 1;
}
- wd = td->io_ops->data;
+ wd = td->io_ops_data;
wd->iothread_running = TRUE;
wd->iocp = hFile;
@@ -131,7 +131,7 @@ static void fio_windowsaio_cleanup(struct thread_data *td)
{
struct windowsaio_data *wd;
- wd = td->io_ops->data;
+ wd = td->io_ops_data;
if (wd != NULL) {
wd->iothread_running = FALSE;
@@ -143,7 +143,7 @@ static void fio_windowsaio_cleanup(struct thread_data *td)
free(wd->aio_events);
free(wd);
- td->io_ops->data = NULL;
+ td->io_ops_data = NULL;
}
}
@@ -203,10 +203,10 @@ static int fio_windowsaio_open_file(struct thread_data *td, struct fio_file *f)
/* Only set up the completion port and thread if we're not just
* querying the device size */
- if (!rc && td->io_ops->data != NULL) {
+ if (!rc && td->io_ops_data != NULL) {
struct windowsaio_data *wd;
- wd = td->io_ops->data;
+ wd = td->io_ops_data;
if (CreateIoCompletionPort(f->hFile, wd->iocp, 0, 0) == NULL) {
log_err("windowsaio: failed to create io completion port\n");
@@ -251,7 +251,7 @@ static BOOL timeout_expired(DWORD start_count, DWORD end_count)
static struct io_u* fio_windowsaio_event(struct thread_data *td, int event)
{
- struct windowsaio_data *wd = td->io_ops->data;
+ struct windowsaio_data *wd = td->io_ops_data;
return wd->aio_events[event];
}
@@ -259,7 +259,7 @@ static int fio_windowsaio_getevents(struct thread_data *td, unsigned int min,
unsigned int max,
const struct timespec *t)
{
- struct windowsaio_data *wd = td->io_ops->data;
+ struct windowsaio_data *wd = td->io_ops_data;
unsigned int dequeued = 0;
struct io_u *io_u;
int i;
diff --git a/fio.h b/fio.h
index 8a0ebe3..87a94f6 100644
--- a/fio.h
+++ b/fio.h
@@ -227,6 +227,12 @@ struct thread_data {
struct ioengine_ops *io_ops;
/*
+ * IO engine private data and dlhandle.
+ */
+ void *io_ops_data;
+ void *io_ops_dlhandle;
+
+ /*
* Queue depth of io_u's that fio MIGHT do
*/
unsigned int cur_depth;
diff --git a/ioengine.h b/ioengine.h
index 161acf5..0effade 100644
--- a/ioengine.h
+++ b/ioengine.h
@@ -163,8 +163,6 @@ struct ioengine_ops {
void (*io_u_free)(struct thread_data *, struct io_u *);
int option_struct_size;
struct fio_option *options;
- void *data;
- void *dlhandle;
};
enum fio_ioengine_flags {
diff --git a/ioengines.c b/ioengines.c
index e2e7280..918b50a 100644
--- a/ioengines.c
+++ b/ioengines.c
@@ -119,13 +119,13 @@ static struct ioengine_ops *dlopen_ioengine(struct thread_data *td,
return NULL;
}
- ops->dlhandle = dlhandle;
+ td->io_ops_dlhandle = dlhandle;
return ops;
}
struct ioengine_ops *load_ioengine(struct thread_data *td, const char *name)
{
- struct ioengine_ops *ops, *ret;
+ struct ioengine_ops *ops;
char engine[16];
dprint(FD_IO, "load ioengine %s\n", name);
@@ -153,11 +153,7 @@ struct ioengine_ops *load_ioengine(struct thread_data *td, const char *name)
if (check_engine_ops(ops))
return NULL;
- ret = malloc(sizeof(*ret));
- memcpy(ret, ops, sizeof(*ret));
- ret->data = NULL;
-
- return ret;
+ return ops;
}
/*
@@ -173,10 +169,9 @@ void free_ioengine(struct thread_data *td)
td->eo = NULL;
}
- if (td->io_ops->dlhandle)
- dlclose(td->io_ops->dlhandle);
+ if (td->io_ops_dlhandle)
+ dlclose(td->io_ops_dlhandle);
- free(td->io_ops);
td->io_ops = NULL;
}
@@ -186,7 +181,7 @@ void close_ioengine(struct thread_data *td)
if (td->io_ops->cleanup) {
td->io_ops->cleanup(td);
- td->io_ops->data = NULL;
+ td->io_ops_data = NULL;
}
free_ioengine(td);
--
2.5.5
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 12/15] Fix stat(2) related bugs introduced by changes made for Windows
2016-07-27 13:37 [PATCH 01/15] Make return value type of fio_getaffinity() consistent Tomohiro Kusumi
` (9 preceding siblings ...)
2016-07-27 13:37 ` [PATCH 11/15] Don't malloc/memcpy ioengine_ops on td initialization Tomohiro Kusumi
@ 2016-07-27 13:37 ` Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 13/15] Rename exists_and_not_file() to exists_and_not_regfile() Tomohiro Kusumi
` (3 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Tomohiro Kusumi @ 2016-07-27 13:37 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
Non-Windows could have regular files that start with "\\\\.\\",
so the conditionals added by ecc314ba and 3892182a in 2011-2012
introduced corner case bugs, though in reality I doubt anyone
would want to create such a file.
This commit brings back the original conditional that was there
before ecc314ba for non-Windows platforms. It also adds WIN32
guard for a change made by 3892182a.
--
# uname
Linux
# cat ./test1.c
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
/* copied from fio/init.c */
static int exists_and_not_file(const char *filename)
{
struct stat sb;
if (lstat(filename, &sb) == -1)
return 0;
/* \\.\ is the device namespace in Windows, where every file
* is a device node */
if (S_ISREG(sb.st_mode) && strncmp(filename, "\\\\.\\", 4) != 0)
return 0;
return 1;
}
int main(int argc, char **argv) {
printf("exists_and_not_file(\"%s\") = %d\n",
argv[1], exists_and_not_file(argv[1]));
return 0;
}
# gcc -Wall -g ./test1.c -o test1
# ls /dev/sda
/dev/sda
# ./test1 /dev/sda
exists_and_not_file("/dev/sda") = 1 /* the existing blkdev isn't a file */
# touch xxxxx
# ./test1 ./xxxxx
exists_and_not_file("./xxxxx") = 0 /* the existing regfile is not not a file */
# touch "\\\\.\\xxxxx"
# ./test1 "\\\\.\\xxxxx"
exists_and_not_file("\\.\xxxxx") = 1 /* XXX */
# stat "\\\\.\\xxxxx" | head -2
File: `\\\\.\\xxxxx'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
---
filesetup.c | 2 ++
init.c | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/filesetup.c b/filesetup.c
index d208a69..a48faf5 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -1225,10 +1225,12 @@ static void get_file_type(struct fio_file *f)
else
f->filetype = FIO_TYPE_FILE;
+#ifdef WIN32
/* \\.\ is the device namespace in Windows, where every file is
* a block device */
if (strncmp(f->file_name, "\\\\.\\", 4) == 0)
f->filetype = FIO_TYPE_BD;
+#endif
if (!stat(f->file_name, &sb)) {
if (S_ISBLK(sb.st_mode))
diff --git a/init.c b/init.c
index 47519bf..82b21c7 100644
--- a/init.c
+++ b/init.c
@@ -911,10 +911,15 @@ static int exists_and_not_file(const char *filename)
if (lstat(filename, &sb) == -1)
return 0;
+#ifndef WIN32 /* NOT Windows */
+ if (S_ISREG(sb.st_mode))
+ return 0;
+#else
/* \\.\ is the device namespace in Windows, where every file
* is a device node */
if (S_ISREG(sb.st_mode) && strncmp(filename, "\\\\.\\", 4) != 0)
return 0;
+#endif
return 1;
}
--
2.5.5
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 13/15] Rename exists_and_not_file() to exists_and_not_regfile()
2016-07-27 13:37 [PATCH 01/15] Make return value type of fio_getaffinity() consistent Tomohiro Kusumi
` (10 preceding siblings ...)
2016-07-27 13:37 ` [PATCH 12/15] Fix stat(2) related bugs introduced by changes made for Windows Tomohiro Kusumi
@ 2016-07-27 13:37 ` Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 14/15] Add missing archs in fio_arch_strings[] Tomohiro Kusumi
` (2 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Tomohiro Kusumi @ 2016-07-27 13:37 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
Renaming makes the purpose of this function more clear IMO.
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
---
init.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/init.c b/init.c
index 82b21c7..f81db3c 100644
--- a/init.c
+++ b/init.c
@@ -904,7 +904,7 @@ static const char *get_engine_name(const char *str)
return p;
}
-static int exists_and_not_file(const char *filename)
+static int exists_and_not_regfile(const char *filename)
{
struct stat sb;
@@ -1347,7 +1347,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
if (!o->filename && !td->files_index && !o->read_iolog_file) {
file_alloced = 1;
- if (o->nr_files == 1 && exists_and_not_file(jobname))
+ if (o->nr_files == 1 && exists_and_not_regfile(jobname))
add_file(td, jobname, job_add_num, 0);
else {
for (i = 0; i < o->nr_files; i++)
--
2.5.5
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 14/15] Add missing archs in fio_arch_strings[]
2016-07-27 13:37 [PATCH 01/15] Make return value type of fio_getaffinity() consistent Tomohiro Kusumi
` (11 preceding siblings ...)
2016-07-27 13:37 ` [PATCH 13/15] Rename exists_and_not_file() to exists_and_not_regfile() Tomohiro Kusumi
@ 2016-07-27 13:37 ` Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 15/15] Change arch_i386 to arch_x86 Tomohiro Kusumi
2016-07-27 14:30 ` [PATCH 01/15] Make return value type of fio_getaffinity() consistent Jens Axboe
14 siblings, 0 replies; 19+ messages in thread
From: Tomohiro Kusumi @ 2016-07-27 13:37 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
Add MIPS and AArch64 after PARISC.
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
---
libfio.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libfio.c b/libfio.c
index 2586675..fb7d35a 100644
--- a/libfio.c
+++ b/libfio.c
@@ -47,6 +47,7 @@ unsigned long arch_flags = 0;
uintptr_t page_mask = 0;
uintptr_t page_size = 0;
+/* see os/os.h */
static const char *fio_os_strings[os_nr] = {
"Invalid",
"Linux",
@@ -62,6 +63,7 @@ static const char *fio_os_strings[os_nr] = {
"DragonFly",
};
+/* see arch/arch.h */
static const char *fio_arch_strings[arch_nr] = {
"Invalid",
"x86-64",
@@ -75,6 +77,8 @@ static const char *fio_arch_strings[arch_nr] = {
"arm",
"sh",
"hppa",
+ "mips",
+ "aarch64",
"generic"
};
--
2.5.5
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 15/15] Change arch_i386 to arch_x86
2016-07-27 13:37 [PATCH 01/15] Make return value type of fio_getaffinity() consistent Tomohiro Kusumi
` (12 preceding siblings ...)
2016-07-27 13:37 ` [PATCH 14/15] Add missing archs in fio_arch_strings[] Tomohiro Kusumi
@ 2016-07-27 13:37 ` Tomohiro Kusumi
2016-07-27 14:30 ` [PATCH 01/15] Make return value type of fio_getaffinity() consistent Jens Axboe
14 siblings, 0 replies; 19+ messages in thread
From: Tomohiro Kusumi @ 2016-07-27 13:37 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
fio_arch_strings[arch_i386] is "x86" (not "i386"),
so change arch_i386 to arch_x86.
Other than arch_i386, "i386" is only used in __i386__.
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
---
arch/arch-x86.h | 2 +-
arch/arch.h | 2 +-
os/os-linux-syscall.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arch-x86.h b/arch/arch-x86.h
index d3b8985..457b44c 100644
--- a/arch/arch-x86.h
+++ b/arch/arch-x86.h
@@ -12,7 +12,7 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
#include "arch-x86-common.h"
-#define FIO_ARCH (arch_i386)
+#define FIO_ARCH (arch_x86)
#define FIO_HUGE_PAGE 4194304
diff --git a/arch/arch.h b/arch/arch.h
index 043e283..00d247c 100644
--- a/arch/arch.h
+++ b/arch/arch.h
@@ -3,7 +3,7 @@
enum {
arch_x86_64 = 1,
- arch_i386,
+ arch_x86,
arch_ppc,
arch_ia64,
arch_s390,
diff --git a/os/os-linux-syscall.h b/os/os-linux-syscall.h
index 2de02f1..c399b2f 100644
--- a/os/os-linux-syscall.h
+++ b/os/os-linux-syscall.h
@@ -3,7 +3,7 @@
#include "../arch/arch.h"
-/* Linux syscalls for i386 */
+/* Linux syscalls for x86 */
#if defined(ARCH_X86_H)
#ifndef __NR_ioprio_set
#define __NR_ioprio_set 289
--
2.5.5
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 04/15] Add FIO_HAVE_BLKDEV_INVALIDATE_CACHE to selectively support pagecache invalidation
2016-07-27 13:37 ` [PATCH 04/15] Add FIO_HAVE_BLKDEV_INVALIDATE_CACHE to selectively support pagecache invalidation Tomohiro Kusumi
@ 2016-07-27 14:25 ` Jens Axboe
2016-07-27 14:44 ` Tomohiro Kusumi
0 siblings, 1 reply; 19+ messages in thread
From: Jens Axboe @ 2016-07-27 14:25 UTC (permalink / raw)
To: Tomohiro Kusumi; +Cc: fio
On Wed, Jul 27 2016, Tomohiro Kusumi wrote:
> Most kernels either don't provide a way to invalidate the cache
> or don't need to provide one as "block device" no longer exist
> as a file type after being replaced by character device.
> Linux (incl Android) is the only supported OS that actually does
> something via ioctl.
>
> This commit adds FIO_HAVE_BLKDEV_INVALIDATE_CACHE. If this macro
> is undefined, cache invalidation for block device isn't supported.
> Only Linux supports it as mentioned above. It's better to do this
> like other OS specific features, because having blockdev_invalidate_cache()
> implementation which only pretends as if it has invalidated cache
> (by returning either 0 or EINVAL) could be misleading for users.
>
> The drawback is this commit requires users to fix config files
> (remove invalidate=) in order to use them on other platforms
> that were portable till then.
This seems to equate invalidate with only working on a block device,
which is not true. And for files, it'll work fine on non-linux as well,
using the fadvise functions.
--
Jens Axboe
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 01/15] Make return value type of fio_getaffinity() consistent
2016-07-27 13:37 [PATCH 01/15] Make return value type of fio_getaffinity() consistent Tomohiro Kusumi
` (13 preceding siblings ...)
2016-07-27 13:37 ` [PATCH 15/15] Change arch_i386 to arch_x86 Tomohiro Kusumi
@ 2016-07-27 14:30 ` Jens Axboe
2016-07-27 14:44 ` Tomohiro Kusumi
14 siblings, 1 reply; 19+ messages in thread
From: Jens Axboe @ 2016-07-27 14:30 UTC (permalink / raw)
To: Tomohiro Kusumi; +Cc: fio
On Wed, Jul 27 2016, Tomohiro Kusumi wrote:
> Return type of fio_getaffinity() isn't consistent among supported OS.
> Windows and DragonFlyBSD return void while FreeBSD version is int.
> The default version for those that don't support is do{}while(0).
>
> Linux version is a macro for sched_getaffinity(2) which returns 0
> on success and -1 otherwise, so others should basically follow that.
>
> Note that I haven't compiled this on Windows, but it shouldn't fail.
Thanks, applied this and the rest, except for the one I commented on.
--
Jens Axboe
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 04/15] Add FIO_HAVE_BLKDEV_INVALIDATE_CACHE to selectively support pagecache invalidation
2016-07-27 14:25 ` Jens Axboe
@ 2016-07-27 14:44 ` Tomohiro Kusumi
0 siblings, 0 replies; 19+ messages in thread
From: Tomohiro Kusumi @ 2016-07-27 14:44 UTC (permalink / raw)
To: Jens Axboe; +Cc: fio
ah ok, sorry about that.
this option does cover regfiles..
2016-07-27 23:25 GMT+09:00 Jens Axboe <axboe@kernel.dk>:
> On Wed, Jul 27 2016, Tomohiro Kusumi wrote:
>> Most kernels either don't provide a way to invalidate the cache
>> or don't need to provide one as "block device" no longer exist
>> as a file type after being replaced by character device.
>> Linux (incl Android) is the only supported OS that actually does
>> something via ioctl.
>>
>> This commit adds FIO_HAVE_BLKDEV_INVALIDATE_CACHE. If this macro
>> is undefined, cache invalidation for block device isn't supported.
>> Only Linux supports it as mentioned above. It's better to do this
>> like other OS specific features, because having blockdev_invalidate_cache()
>> implementation which only pretends as if it has invalidated cache
>> (by returning either 0 or EINVAL) could be misleading for users.
>>
>> The drawback is this commit requires users to fix config files
>> (remove invalidate=) in order to use them on other platforms
>> that were portable till then.
>
> This seems to equate invalidate with only working on a block device,
> which is not true. And for files, it'll work fine on non-linux as well,
> using the fadvise functions.
>
> --
> Jens Axboe
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 01/15] Make return value type of fio_getaffinity() consistent
2016-07-27 14:30 ` [PATCH 01/15] Make return value type of fio_getaffinity() consistent Jens Axboe
@ 2016-07-27 14:44 ` Tomohiro Kusumi
0 siblings, 0 replies; 19+ messages in thread
From: Tomohiro Kusumi @ 2016-07-27 14:44 UTC (permalink / raw)
To: Jens Axboe; +Cc: fio
Thank you !
2016-07-27 23:30 GMT+09:00 Jens Axboe <axboe@kernel.dk>:
> On Wed, Jul 27 2016, Tomohiro Kusumi wrote:
>> Return type of fio_getaffinity() isn't consistent among supported OS.
>> Windows and DragonFlyBSD return void while FreeBSD version is int.
>> The default version for those that don't support is do{}while(0).
>>
>> Linux version is a macro for sched_getaffinity(2) which returns 0
>> on success and -1 otherwise, so others should basically follow that.
>>
>> Note that I haven't compiled this on Windows, but it shouldn't fail.
>
> Thanks, applied this and the rest, except for the one I commented on.
>
> --
> Jens Axboe
>
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2016-07-27 14:44 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-27 13:37 [PATCH 01/15] Make return value type of fio_getaffinity() consistent Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 02/15] Fix typos in log_err() message Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 03/15] Use default CPU_COUNT() function in DragonFlyBSD Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 04/15] Add FIO_HAVE_BLKDEV_INVALIDATE_CACHE to selectively support pagecache invalidation Tomohiro Kusumi
2016-07-27 14:25 ` Jens Axboe
2016-07-27 14:44 ` Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 05/15] Use sizeof(char*) instead of sizeof(void*) Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 06/15] Mention default values for readwrite=/ioengine=/mem= in documentation Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 07/15] Mention cpuio never finishes without real I/O " Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 08/15] Ignore exit_io_done= option if no I/O threads are configured Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 09/15] Use correct I/O engine name "cpuio" instead of "cpu" Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 10/15] Add missing --cmdhelp type string for FIO_OPT_UNSUPPORTED Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 11/15] Don't malloc/memcpy ioengine_ops on td initialization Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 12/15] Fix stat(2) related bugs introduced by changes made for Windows Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 13/15] Rename exists_and_not_file() to exists_and_not_regfile() Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 14/15] Add missing archs in fio_arch_strings[] Tomohiro Kusumi
2016-07-27 13:37 ` [PATCH 15/15] Change arch_i386 to arch_x86 Tomohiro Kusumi
2016-07-27 14:30 ` [PATCH 01/15] Make return value type of fio_getaffinity() consistent Jens Axboe
2016-07-27 14:44 ` Tomohiro Kusumi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox