8 years agoverify: use 'cmp_pattern' from 'lib/pattern.c' to compare pattern and buffer
Roman Pen [Wed, 19 Aug 2015 10:33:09 +0000 (12:33 +0200)]
verify: use 'cmp_pattern' from 'lib/pattern.c' to compare pattern and buffer

'cmp_pattern' function should be faster, since it does not use loops
and while doing 'memcmp' the same CPU cache line is used.

Keep in mind, that now single-byte pattern becomes the string of 512 bytes.
In that case this optimization will not work as expected, since 'memcmp'
will be called twice for the whole pattern, but in next patches this
behaviour will be avoided and single-byte pattern will stay single-byte
pattern without any attempt to duplicate it.

Also print buffer and pattern bytes as unsigned chars.

Signed-off-by: Roman Pen <>
Signed-off-by: Jens Axboe <>
8 years agoreplace 'fill_pattern' with 'cpy_pattern' from 'lib/pattern.c'
Roman Pen [Wed, 19 Aug 2015 10:33:08 +0000 (12:33 +0200)]
replace 'fill_pattern' with 'cpy_pattern' from 'lib/pattern.c'

All pattern helpers are now located inside 'lib/pattern.c',
and 'cpy_pattern' should be sligtly faster, since it does
copy doubling the size on every iteration.

Signed-off-by: Roman Pen <>
Signed-off-by: Jens Axboe <>
8 years agolib/pattern: add set of functions to parse combined pattern input
Roman Pen [Wed, 19 Aug 2015 10:33:07 +0000 (12:33 +0200)]
lib/pattern: add set of functions to parse combined pattern input

The idea of this patch is to have several helpers to parse combined
pattern input, which can consists of strings, numbers and formats.

For example now pattern can be combined and look like this string:

 input : 0xdeadbeef"123"0xdeadface
 output: de ad be ef 31 32 33 de ad fa ce


 input : -99"some string"0x66
 output: 9d ff ff ff 73 6f 6d 65 20 73 74 72 69 6e 67 66

  or with formats

 input : 0xdeadface0xffff%o
 output: de ad fa ce ff ff 00 00 00 00 00 00 00 00

 where %o - offset of the block, reserved 8 bytes

 Space for formats is reserved in output buffer.
 When buffer will be ready to be written to disk - 'paste' callback
 should be called for each pattern format. Each callback is responsible
 for writing data inside the reserved space in the output buffer.

Format array can be extended at any time, all you need is to provide
the name of the format and correct 'paste' callback.

Signed-off-by: Roman Pen <>
Signed-off-by: Jens Axboe <>
8 years agolib/strntol: add 'strntol' function
Roman Pen [Wed, 19 Aug 2015 10:33:06 +0000 (12:33 +0200)]
lib/strntol: add 'strntol' function

In future patches I will need it.

Signed-off-by: Roman Pen <>
Signed-off-by: Jens Axboe <>
8 years agoRetry bdev cache invalidation for EAGAIN errors
Ken Raeburn [Fri, 4 Sep 2015 19:30:58 +0000 (13:30 -0600)]
Retry bdev cache invalidation for EAGAIN errors

I've hit a couple test failures where fio quickly died thusly:

    fio 2.0.7
    Starting 1 thread
    fio: pid=6196, err=11/file:filesetup.c:404, func=invalidate_cache, error=Resource temporarily unavailable

(Yeah, we're a little behind. But I think the relevant code is similar.)

We're testing against Linux (RHEL 6.6) multipath block devices, and it
appears that at the time the fio test starts, the multipath maps for
those devices may still be in flux. I poked around a bit with systemtap,
and it appears that while updating the maps, multipathd "suspends" its
multipath device for a few tens of milliseconds, and the kernel
multipath code rejects ioctl calls with EAGAIN if the device is
suspended. It's a small window, but we've managed to hit it multiple
times, though it's not reliably reproducible.

I know the current sources treat failure here as non-fatal, but if we're
using fio for performance tests, trying a little harder to do the
invalidation seems like a good idea. My approach is to add a retry loop
in __file_invalidate_cache; a patch is attached.

It could also be pushed down into blockdev_invalidate_cache, where it
could be local to the Linux (and Android?) implementation, since none of
the others actually do anything. (They return either EAGAIN or zero,
both of which are taken as success indicators.)

Signed-off-by: Jens Axboe <>
8 years agobackend: fix comparison of 'ret' pointer
Andrey Kuzmin [Fri, 4 Sep 2015 19:23:49 +0000 (13:23 -0600)]
backend: fix comparison of 'ret' pointer

Commit e9d512d8e7d2 abstracted out this code, but the assert()
was never changed.

Signed-off-by: Jens Axboe <>
8 years agoFix aux_path for verify state saving
Jens Axboe [Fri, 21 Aug 2015 18:09:03 +0000 (11:09 -0700)]
Fix aux_path for verify state saving

Botched the string copies.

Fixes: d264264a08 ("Add --aux-path support"
Signed-off-by: Jens Axboe <>
8 years agoparse: only print option mismatch help, if the distance is close enough
Jens Axboe [Fri, 21 Aug 2015 18:01:29 +0000 (11:01 -0700)]
parse: only print option mismatch help, if the distance is close enough

Signed-off-by: Jens Axboe <>
8 years agoAdd --aux-path support
Jens Axboe [Thu, 20 Aug 2015 19:02:05 +0000 (12:02 -0700)]
Add --aux-path support

For certain files, fio just stores them in the current working
directory. This can create a bit of a mess. These files might
be verification dump files, or verification state saves.

Add --aux-path to enable storing these files in an arbitrary
directory instead.

Signed-off-by: Jens Axboe <>
8 years agoREADME: update for trigger options
Jens Axboe [Thu, 20 Aug 2015 18:59:08 +0000 (11:59 -0700)]
README: update for trigger options

Signed-off-by: Jens Axboe <>
8 years agoconfigure: cleanup strsep() test case
Jens Axboe [Tue, 18 Aug 2015 18:26:00 +0000 (11:26 -0700)]
configure: cleanup strsep() test case

Signed-off-by: Jens Axboe <>
8 years agoconfigure: fixup using wrong var for endmntent()
Jens Axboe [Tue, 18 Aug 2015 18:23:00 +0000 (11:23 -0700)]
configure: fixup using wrong var for endmntent()

Signed-off-by: Jens Axboe <>
8 years agoMerge branch 'master' of git://
Jens Axboe [Tue, 18 Aug 2015 17:19:50 +0000 (11:19 -0600)]
Merge branch 'master' of git://

8 years agoCorrect handleing of rate_iops_min and ratemin
Dave [Tue, 18 Aug 2015 16:39:11 +0000 (10:39 -0600)]
Correct handleing of rate_iops_min and ratemin

change to allow ratemin to be set without rate disabled ratemin checking in __check_min_rate.

Separate from the change to ratemin parsing, rate_iops_min check did not result in "return 1;" so jobs would not terminate on a failure to maintain rate_iops_min.

8 years agomtd: expand configure check
Jens Axboe [Mon, 17 Aug 2015 21:47:42 +0000 (15:47 -0600)]
mtd: expand configure check

SLES 11.4 has enough of mtd to pass the configure checks, but not
to compile it. Expand the checks to hopefully be enough.

Signed-off-by: Jens Axboe <>
8 years agogettime: silence bogus gcc warnings
Jens Axboe [Mon, 17 Aug 2015 21:46:22 +0000 (15:46 -0600)]
gettime: silence bogus gcc warnings

Signed-off-by: Jens Axboe <>
8 years agoMerge branch 'master' of git://
Jens Axboe [Mon, 17 Aug 2015 21:39:23 +0000 (15:39 -0600)]
Merge branch 'master' of git://

8 years agoallow for ratemin to be used without setting rate
DaveGlen [Mon, 17 Aug 2015 16:04:09 +0000 (10:04 -0600)]
allow for ratemin to be used without setting rate

Only check if ratemin < rate when rate is set.

8 years agofilesetup: make random generator block auto-switch on huge files
Jens Axboe [Fri, 14 Aug 2015 18:25:20 +0000 (12:25 -0600)]
filesetup: make random generator block auto-switch on huge files

Signed-off-by: Jens Axboe <>
8 years agoclient: make it explicit that we don't reuse 'eta' after freeing it
Jens Axboe [Fri, 14 Aug 2015 15:45:46 +0000 (09:45 -0600)]
client: make it explicit that we don't reuse 'eta' after freeing it

Signed-off-by: Jens Axboe <>
8 years agoeta: ensure we include terminating 0 space in je->run_str[]
Jens Axboe [Fri, 14 Aug 2015 15:42:55 +0000 (09:42 -0600)]
eta: ensure we include terminating 0 space in je->run_str[]

Signed-off-by: Jens Axboe <>
8 years agoarch-ppc.h: Add ilog2 implementation for ppc64
Chandan Rajendra [Tue, 11 Aug 2015 09:41:26 +0000 (15:11 +0530)]
arch-ppc.h: Add ilog2 implementation for ppc64

On a ppc64 machine, when fio is invoked with the following configuration file
(generated by fstests' generic/300 test), it loops indefinitely.







This is because arch_ffz() ends up invoking the 32-bit version of __ilog2()
which always returns a bit number in the range 0 - 31. This can cause
"overlap" variable in axmap_set_fn() to never becomes zero.

To fix this the commit adds a 64-bit version of __ilog2() (obtained from the
Linux kernel's arch/powerpc/include/asm/bitops.h).

Signed-off-by: Chandan Rajendra <>
Signed-off-by: Jens Axboe <>
8 years agoWhitespace fixup
Jens Axboe [Thu, 13 Aug 2015 15:31:17 +0000 (09:31 -0600)]
Whitespace fixup

Introduced by commit 50a8ce864e2c.

Signed-off-by: Jens Axboe <>
8 years agoinitialize rate_io_issue_bytes
DaveGlen [Mon, 10 Aug 2015 19:39:31 +0000 (13:39 -0600)]
initialize rate_io_issue_bytes

8 years agoImplement new Rate Control
DaveGlen [Mon, 10 Aug 2015 18:47:53 +0000 (12:47 -0600)]
Implement new Rate Control

Current implementation of rate control has the potential for bursts and
stalls when iodepth>1 due to feedback delay while IO is pending.  more
description here:

This commit changes the rate control mechanisms to use feed forward io
issues for rate feedback. Moving the rate control on submissions
instead of completions eliminates feedback delay. More details on the
change here:

8 years agoserver: make the setsockopt() error output a bit more informative
Jens Axboe [Wed, 29 Jul 2015 15:00:03 +0000 (09:00 -0600)]
server: make the setsockopt() error output a bit more informative

Signed-off-by: Jens Axboe <>
8 years agoconfigure: add --disable-optimizations
Jens Axboe [Mon, 27 Jul 2015 21:10:00 +0000 (15:10 -0600)]
configure: add --disable-optimizations

Sometimes we want to build without optimizations enabled for
debugging issues, make this possible without editing the

Also fixup --disable-shm to not output a symbol until after
we have initialized config-host.*.

Signed-off-by: Jens Axboe <>
8 years agoFix potential divide-by-zero in calc_iops()
Jens Axboe [Mon, 27 Jul 2015 18:29:55 +0000 (12:29 -0600)]
Fix potential divide-by-zero in calc_iops()

Signed-off-by: Jens Axboe <>
8 years agoFix potential divide-by-zero in calc_rate()
Jens Axboe [Mon, 27 Jul 2015 18:26:12 +0000 (12:26 -0600)]
Fix potential divide-by-zero in calc_rate()

Signed-off-by: Jens Axboe <>
8 years agoconfigure: make __sync_fetch_and_add() test use 64-bit types
Jens Axboe [Mon, 27 Jul 2015 18:22:14 +0000 (12:22 -0600)]
configure: make __sync_fetch_and_add() test use 64-bit types

Signed-off-by: Jens Axboe <>
8 years agolibfio: add runstate names
Jens Axboe [Mon, 27 Jul 2015 18:08:33 +0000 (12:08 -0600)]
libfio: add runstate names

Enables --debug=process to show the actual transitions, instead of
numbers you have to look up in the source:

process  12113 pid=12123: runstate CREATED -> INITIALIZED

instead of

process  12113 pid=12123: runstate 1 -> 2

Signed-off-by: Jens Axboe <>
8 years agoRe-seed random generator correctly between loops
Dave [Thu, 16 Jul 2015 20:56:00 +0000 (14:56 -0600)]
Re-seed random generator correctly between loops

re-seeding random generator in this way means that random patterns will
precisely repeat between iterations.  if rand_repeatable is set, this is
desirable, otherwise it may produce unexpected IO patterns in random IO

Signed-off-by: Jens Axboe <>
8 years agoREADME: no delay on sync to backup git hosts anymore
Jens Axboe [Wed, 15 Jul 2015 14:43:03 +0000 (08:43 -0600)]
README: no delay on sync to backup git hosts anymore

Signed-off-by: Jens Axboe <>
8 years agoHOWTO: spelling error
Jens Axboe [Mon, 13 Jul 2015 20:33:19 +0000 (14:33 -0600)]
HOWTO: spelling error

Another auto-sync test.

Signed-off-by: Jens Axboe <>
8 years agoHOWTO: fix long line
Jens Axboe [Mon, 13 Jul 2015 20:30:03 +0000 (14:30 -0600)]
HOWTO: fix long line

Testing to see if the inline mirroring works.

Signed-off-by: Jens Axboe <>
8 years agoUpdate README for DragonFly
Jens Axboe [Mon, 13 Jul 2015 18:41:51 +0000 (12:41 -0600)]
Update README for DragonFly

Signed-off-by: Jens Axboe <>
8 years agoRDMA engine server mode flow fix ups.
Logan Gunthorpe [Fri, 10 Jul 2015 18:23:55 +0000 (12:23 -0600)]
RDMA engine server mode flow fix ups.

When running fio in RDMA server mode, the user just sees an ever
increasing ETA line. Which is rather uninfromative. This patch
adds a waiting for connection message and sets the thread to SETTING_UP
while waiting.

Then when the server is running the ETA is disabled. (The RDMA server
has no access to progress information.)

8 years agoError when the block size on the RDMA server is less than the client
Logan Gunthorpe [Fri, 10 Jul 2015 17:54:25 +0000 (11:54 -0600)]
Error when the block size on the RDMA server is less than the client

When running an rdma client with a block size set less than
the block size set on the server, currently the code crashes.

This patch has the two sides exchange max_bs values and errors
out gracefully if the server side is too small.

8 years agobuffer: only set refill_buffers, it it wasn't set manually
Jens Axboe [Fri, 10 Jul 2015 15:27:02 +0000 (09:27 -0600)]
buffer: only set refill_buffers, it it wasn't set manually

Signed-off-by: Jens Axboe <>
8 years agoMake td flags be shifts
Jens Axboe [Fri, 10 Jul 2015 15:11:26 +0000 (09:11 -0600)]
Make td flags be shifts

Signed-off-by: Jens Axboe <>
8 years agoverify: fix bad 'from_verify' setting in do_io()
Jens Axboe [Thu, 9 Jul 2015 19:13:43 +0000 (13:13 -0600)]
verify: fix bad 'from_verify' setting in do_io()

Signed-off-by: Jens Axboe <>
8 years agoconfigure: don't be so eager to overwrite an existing Makefile
Jeremy Fitzhardinge [Wed, 8 Jul 2015 20:50:35 +0000 (13:50 -0700)]
configure: don't be so eager to overwrite an existing Makefile

8 years agofio: allow for build in separate build directory
Jeremy Fitzhardinge [Wed, 8 Jul 2015 20:27:35 +0000 (13:27 -0700)]
fio: allow for build in separate build directory

Change configure so that it will use its current directory for building,
and the path to the script itself as the source directory.

Change the Makefile to use VPATH to find the source files. Only a few other
things needed to be touched:
 - use the full path to the source in wildcard, then strip it off again
 - search both build and source for header files
 - FIO-VERSION-GEN is in source
 - make directories in build as needed
 - use $< to refer to input files
 - install non-executables from source

Signed-off-by: Jeremy Fitzhardinge <>
8 years agot/debug: fix 'fio_debug' declaration
Jens Axboe [Fri, 3 Jul 2015 20:26:08 +0000 (14:26 -0600)]
t/debug: fix 'fio_debug' declaration

debug.h:38:22: warning: type of ‘fio_debug’ does not match original declaration
 extern unsigned long fio_debug;
t/debug.c:5:14: note: previously declared here
 unsigned int fio_debug = 0;

Signed-off-by: Jens Axboe <>
8 years agosmalloc: smalloc() already clears memory, scalloc() need not do it again
Jens Axboe [Fri, 3 Jul 2015 17:47:10 +0000 (11:47 -0600)]
smalloc: smalloc() already clears memory, scalloc() need not do it again

Signed-off-by: Jens Axboe <>
8 years agosmalloc: fix unused 'int_mask' warning if redzoning is turned off
Jens Axboe [Tue, 30 Jun 2015 21:31:50 +0000 (15:31 -0600)]
smalloc: fix unused 'int_mask' warning if redzoning is turned off

Signed-off-by: Jens Axboe <>
8 years agoconfigure: fixup clang stupidity
Jens Axboe [Tue, 30 Jun 2015 02:46:31 +0000 (20:46 -0600)]
configure: fixup clang stupidity

Doesn't like doing _Static_assert() on our structure offset

error: static_assert expression is not an integral constant expression

Lets just include that in the configure test, so we can avoid using
_Static_assert() if that kind of check fails.

Signed-off-by: Jens Axboe <>
8 years agot/stest: shrink test size from 128MB
Jens Axboe [Tue, 30 Jun 2015 02:27:37 +0000 (20:27 -0600)]
t/stest: shrink test size from 128MB

We reduced the smalloc size, reduce it in the test cases too.

Signed-off-by: Jens Axboe <>
8 years agoKill duplicate __sync_fetch_and_add()
Jens Axboe [Mon, 29 Jun 2015 19:19:24 +0000 (13:19 -0600)]
Kill duplicate __sync_fetch_and_add()

We already had CONFIG_SFAA, just missed it. No need to duplicate it,
get rid of it and update the check in workqueue.c.

Signed-off-by: Jens Axboe <>
8 years agoUse _Static_assert() if available
Alireza Haghdoost [Mon, 29 Jun 2015 19:09:37 +0000 (13:09 -0600)]
Use _Static_assert() if available

The current compiletime_assert() doesn't work properly if code
optimization is not enabled, causing all compile time asserts to fail
regardless of the condition. This is because the compiler doesn't
realize that the external function will never get called for the
false case.

Use _Static_assert() if available for compiletime_assert(), and
fallback to the old method if we don't have it.

Signed-off-by: Jens Axboe <>
8 years agoworkqueue: make it work on platforms without __sync_fetch_and_add()
Jens Axboe [Mon, 29 Jun 2015 15:34:39 +0000 (09:34 -0600)]
workqueue: make it work on platforms without __sync_fetch_and_add()

Signed-off-by: Jens Axboe <>
8 years agoFio 2.2.9 fio-2.2.9
Jens Axboe [Thu, 25 Jun 2015 17:13:19 +0000 (11:13 -0600)]
Fio 2.2.9

Signed-off-by: Jens Axboe <>
8 years agoFix testing and setting set_options bitmap
Akinobu Mita [Thu, 25 Jun 2015 13:39:41 +0000 (22:39 +0900)]
Fix testing and setting set_options bitmap

set_options bitmap is an array of uint64_t.  But while testing and
setting a bit in the bitmap, the bit mask is calculated with an
unsigned long value.  For the systems which have 32-bit long type,
upper 32-bit cannot be set correctly.

Fix it by using (uint64_t)1 instead of 1UL to calculate correct bit

Signed-off-by: Akinobu Mita <>
Signed-off-by: Jens Axboe <>
8 years agoModify rdma engine to use proper arguments.
Logan Gunthorpe [Tue, 23 Jun 2015 22:21:07 +0000 (16:21 -0600)]
Modify rdma engine to use proper arguments.

The old rdma options are unintuitive and inflexible. We are also going
to do some experiments with this engine which require adding further
options. Thus we've improved it to take more normal arguments.

The technique is copied from the netio engine. It now requires a
hostname, port and verb option. The fio scripts in the example directory
have been updated. Compatability is also maintained for fio scripts that
use the old options.

8 years agoadd eta and elapsed to root of json output
Christopher Jacobs [Mon, 22 Jun 2015 21:14:50 +0000 (14:14 -0700)]
add eta and elapsed to root of json output

8 years agoFix latency logging for io_submit_mode=offload
Jens Axboe [Sat, 20 Jun 2015 17:21:48 +0000 (13:21 -0400)]
Fix latency logging for io_submit_mode=offload

Signed-off-by: Jens Axboe <>
8 years agoHOWTO: make it clear that deviation is standard deviation
Chris Worley [Tue, 16 Jun 2015 15:30:59 +0000 (09:30 -0600)]
HOWTO: make it clear that deviation is standard deviation

Signed-off-by: Jens Axboe <>
8 years agoEnable FIO_HAVE_CHARDEV_SIZE on DragonFlyBSD
Tomohiro Kusumi [Thu, 11 Jun 2015 11:24:11 +0000 (20:24 +0900)]

DragonFlyBSD no longer has block device just like FreeBSD got rid of
it at some point. Enable FIO_HAVE_CHARDEV_SIZE and implement get-size
functions with DragonFlyBSD's ioctl so fio can retrieve correct size
when targets are not regular files.

The following result verifies that df(1) shows the same fs size as
chardev_size() with regards to the character device (block device if
it were on Linux).

 # uname
 # cat ./test3.c
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
 #include "os/os-dragonfly.h"

 int main(int argc, char *argv[]) {
         struct fio_file f;
         unsigned long long bytes;

         f.fd = open(argv[1], O_RDONLY);
         if (f.fd < 0) {

         if (chardev_size(&f, &bytes)) {
         printf("%s %llu\n", argv[1], bytes);
         return 0;
 # gcc -Wall -g ./test3.c -o test3
 # file /dev/da8
 /dev/da8: character special (30/504430663)
 # ./test3 /dev/da8
 /dev/da8 31004295168
 # newfs /dev/da8 > /dev/null
 # mount -t ufs /dev/da8 /mnt
 # df -TH /mnt
 Filesystem  Type   Size   Used  Avail Capacity  Mounted on
 /dev/da8    ufs     31G   2.0k    28G     0%    /mnt

8 years agoRename get_fs_size() to get_fs_free_size()
Tomohiro Kusumi [Wed, 10 Jun 2015 17:46:31 +0000 (02:46 +0900)]
Rename get_fs_size() to get_fs_free_size()

get_fs_free_size() seems to be an appropriate name considering
these functions on various os return filesystem's free space by
computing (block_size * number_of_free_blocks) via statfs(2) or

Also the caller of this function is get_fs_free_counts().

8 years agoAdd get_fs_size() support for BSDs
Tomohiro Kusumi [Wed, 10 Jun 2015 12:45:00 +0000 (21:45 +0900)]
Add get_fs_size() support for BSDs

Add get_fs_size() for FreeBSD/DragonFlyBSD. The same code may
work on NetBSD/OpenBSD as it uses POSIX statvfs(2).

The following results verify df(1) (which also typically uses
statfs(2) or statvfs(2)) shows the same number given that df(1)
output is correct for the given filesystems.

 # uname
 # cat ./test2.c
 #include <stdio.h>
 #include "os/os-freebsd.h"
 int main(int argc, char *argv[]) {
         printf("%s %llu\n", argv[1], get_fs_size(argv[1]));
         return 0;
 # clang -Wall -g ./test2.c -o test2
 # ./test2 /
 / 102783143936
 # df -TH /
 Filesystem   Type    Size    Used   Avail Capacity  Mounted on
 /dev/ada0p2  ufs     112G    9.5G     94G     9%    /
                      ^^^^^^^^^^^^     ^^^
                      112G - 9.5G      bfree!=bavail
                      = 102.5G         like it differs on ext[234]
 # uname
 # cat ./test2.c
 #include <stdio.h>
 #include "os/os-dragonfly.h"
 int main(int argc, char *argv[]) {
         printf("%s %llu\n", argv[1], get_fs_size(argv[1]));
         return 0;
 # gcc -Wall -g ./test2.c -o test2
 # ./test2 /
 / 450287370240
 # df -TH /
 Filesystem  Type     Size   Used  Avail Capacity  Mounted on
 ROOT        hammer   480G    30G   450G     6%    /

8 years agoAdd header include for DragonFlyBSD
Tomohiro Kusumi [Wed, 10 Jun 2015 12:52:45 +0000 (21:52 +0900)]
Add header include for DragonFlyBSD

Add '#include <unistd.h>' to os/os-dragonfly.h for lwp_gettid(2).
(No error on make, but needs <unistd.h> to include this header

8 years agoFix compiler warning
Tomohiro Kusumi [Tue, 9 Jun 2015 23:28:13 +0000 (08:28 +0900)]
Fix compiler warning

The local variable off is uninitialized on 'goto fill'.
Initializing with 0 seems to be appropriate to fix following gcc warning
although off is actually always initialized as the function returns with
1 on 'if (!i)' case.

options.c:920: warning: 'off' may be used uninitialized in this function

8 years agoDropped commented out part of line.
Sam Zaydel [Tue, 9 Jun 2015 21:14:20 +0000 (14:14 -0700)]
Dropped commented out part of line.

8 years agoMerge branch 'master' of into fixtype
Sam Zaydel [Tue, 9 Jun 2015 21:11:36 +0000 (14:11 -0700)]
Merge branch 'master' of into fixtype

8 years agoint may be too small for a size_t on some systems.
Sam Zaydel [Tue, 9 Jun 2015 21:10:25 +0000 (14:10 -0700)]
int may be too small for a size_t on some systems.

8 years agooptions: use fio_option_is_set() to detect verify setting
Jens Axboe [Tue, 9 Jun 2015 20:00:56 +0000 (14:00 -0600)]
options: use fio_option_is_set() to detect verify setting

Signed-off-by: Jens Axboe <>
8 years agoverify: cleanup code for verify pattern without headers
Jens Axboe [Tue, 9 Jun 2015 14:35:29 +0000 (08:35 -0600)]
verify: cleanup code for verify pattern without headers

Signed-off-by: Jens Axboe <>
8 years agoverify: fix dumping of received/expected buffers on failure
Jens Axboe [Tue, 9 Jun 2015 14:06:02 +0000 (08:06 -0600)]
verify: fix dumping of received/expected buffers on failure

If verify=pattern is used, we don't have a header to rely on. So
make one up for that case.

Signed-off-by: Jens Axboe <>
8 years agoverify: add raw pattern verify
Jens Axboe [Tue, 9 Jun 2015 02:43:43 +0000 (20:43 -0600)]
verify: add raw pattern verify

Add specific verify=pattern that doesn't use any headers, it
just writes the specified pattern and verifies it.

Signed-off-by: Jens Axboe <>
8 years agobackend: don't add to runtime for fake writes
Jens Axboe [Tue, 9 Jun 2015 00:43:22 +0000 (18:43 -0600)]
backend: don't add to runtime for fake writes

This fixes showing that fio did writes with --verify_only being set,
while in reality it just ended them before submitting to the device.

Signed-off-by: Jens Axboe <>
8 years agoClear sysfs path before reading current ioscheduler from sysfs
Tomohiro Kusumi [Mon, 8 Jun 2015 10:19:02 +0000 (19:19 +0900)]
Clear sysfs path before reading current ioscheduler from sysfs

switch_ioscheduler() function has a local buffer tmp[] to store
both sysfs path (e.g. /sys/block/`device`/queue/scheduler) and
content of that sysfs path.

In order to properly test strstr() after writing a ioscheduler
string (e.g. "deadline") to sysfs, it needs to memset(0) first.
Otherwise if the content of sysfs path (below (b)) is shorter
than the existing sysfs path in tmp[] (below (a)), then tmp[]
after storing the content of sysfs (below (c) and *haystack of
strstr()) contains remaining part of the sysfs path.

(a) "/sys/block/sdb/queue/scheduler"
(b) "noop [deadline] cfq \n"
(c) "noop [deadline] cfq \nscheduler"

strstr() will result the same given that the remaining part of
the sysfs path is unlikely to contain ioscheduler string, but
the remaining part should still be cleared first.

8 years agoconfigure: add some missing help options
Jens Axboe [Fri, 5 Jun 2015 14:33:56 +0000 (08:33 -0600)]
configure: add some missing help options

Signed-off-by: Jens Axboe <>
8 years agoFix compile error on non Linux-or-BSDs
Tomohiro Kusumi [Fri, 5 Jun 2015 10:15:43 +0000 (19:15 +0900)]
Fix compile error on non Linux-or-BSDs

e7e136da needed to add #else part with another device_is_mounted()
that returns 0 for non Linux-or-BSDs environment. Any environment
without getmntent(3) or getmntinfo(3) needs a blank function.

8 years agoinit: automate displaying debug categories
Jens Axboe [Thu, 4 Jun 2015 19:45:32 +0000 (13:45 -0600)]
init: automate displaying debug categories

Better than having them hardwired, so we don't have to update the
code in several places when adding new categories.

Signed-off-by: Jens Axboe <>
8 years agoAdd device_is_mounted() support for BSDs
Tomohiro Kusumi [Tue, 2 Jun 2015 14:40:44 +0000 (23:40 +0900)]
Add device_is_mounted() support for BSDs

Implement '#elif' part of lib/mountcheck.c using getmntinfo(3).

This should implement device_is_mounted() on most BSDs, and has been
tested on FreeBSD/DragonFlyBSD. NetBSD/OpenBSD do have getmntinfo(3)
but may need to include different headers according to their online

 # cat ./test1.c
 #include <stdio.h>
 #include "./lib/mountcheck.h"
 int main(int argc, char *argv[]) {
  printf("%s %d\n", argv[1], device_is_mounted(argv[1]));
  return 0;

 # uname
 # clang -Wall -g ./test1.c ./lib/mountcheck.o -o ./test1
 # ./test1 /dev/ada0p2  /* UFS */
 /dev/ada0p2 1
 # ./test1 zfs  /* ZFS */
 zfs 1
 # ./test1 zfs/test  /* ZFS */
 zfs/test 1
 # ./test1 /dev/da0  /* not mounted device */
 /dev/da0 0
 # ./test1 random  /* irrelevant string */
 random 0

 # uname
 # gcc -Wall -g ./test1.c ./lib/mountcheck.o -o ./test1
 # ./test1 /pfs/@@-1:00005  /* HAMMER */
 /pfs/@@-1:00005 1
 # ./test1 procfs  /* procfs */
 procfs 1
 # ./test1 /dev/da8  /* not mounted device */
 /dev/da8 0
 # ./test1 random  /* irrelevant string */
 random 0

8 years agoMerge branch 'req6' of git://
Jens Axboe [Mon, 1 Jun 2015 14:32:45 +0000 (08:32 -0600)]
Merge branch 'req6' of git://

8 years agoMinor cleanups on cleanup()
Tomohiro Kusumi [Mon, 1 Jun 2015 13:21:29 +0000 (22:21 +0900)]
Minor cleanups on cleanup()

Sync with the way other engines implement cleanup() that is regarded
as a better practice. td->io_ops->data should have null check before
dereference and its members can be freed without null check.

8 years agoFix build error on non-GNU environment
Tomohiro Kusumi [Mon, 1 Jun 2015 12:32:37 +0000 (21:32 +0900)]
Fix build error on non-GNU environment

'#include <mntent.h>' needs to be inside '#ifdef CONFIG_GETMNTENT'
and that was probably the intention of the commit aae599ba.
e.g. BSDs are likely to hit following compile error.

lib/mountcheck.c:3:20: fatal error: mntent.h: No such file or directory
compilation terminated.
Makefile:275: recipe for target 'lib/mountcheck.o' failed
gmake: *** [lib/mountcheck.o] Error 1

8 years agordma: adapt to new init_rand_seed()
Jens Axboe [Sat, 30 May 2015 19:04:33 +0000 (13:04 -0600)]
rdma: adapt to new init_rand_seed()

engines/rdma.c: In function ‘fio_rdmaio_setup’:
engines/rdma.c:1205: error: too few arguments to function ‘init_rand_seed’
make: *** [engines/rdma.o] Error 1

Signed-off-by: Jens Axboe <>
8 years agofilesetup: print warning if chosen random generator can't cover range
Jens Axboe [Sat, 30 May 2015 01:40:21 +0000 (19:40 -0600)]
filesetup: print warning if chosen random generator can't cover range

If the file or device is huge, we could have an issue with the
default 32-bit random offset generator in that it wont cover
the entire device. If fio detects this and the random generator
wasn't explicitly set, then log an error and exit.

Signed-off-by: Jens Axboe <>
8 years agorand: add 64-bit tausworthe variant with a 2^258 cycle
Jens Axboe [Fri, 29 May 2015 18:49:54 +0000 (12:49 -0600)]
rand: add 64-bit tausworthe variant with a 2^258 cycle

Signed-off-by: Jens Axboe <>
8 years agoAdd Intel rdrand support
Jens Axboe [Fri, 29 May 2015 16:44:19 +0000 (10:44 -0600)]
Add Intel rdrand support

Not wired up.

Signed-off-by: Jens Axboe <>
8 years agotreat error in addr conversion to string as non-fatal
Ben England [Tue, 26 May 2015 19:12:46 +0000 (15:12 -0400)]
treat error in addr conversion to string as non-fatal

8 years agoembed server address, not other end's address
Ben England [Mon, 25 May 2015 12:26:24 +0000 (08:26 -0400)]
embed server address, not other end's address

8 years agocconv: add allow_mounted_write
Jens Axboe [Fri, 22 May 2015 15:09:49 +0000 (09:09 -0600)]
cconv: add allow_mounted_write

Signed-off-by: Jens Axboe <>
8 years agoAdd 'allow_mounted_write' option
Jens Axboe [Fri, 22 May 2015 03:43:48 +0000 (21:43 -0600)]
Add 'allow_mounted_write' option

If this isn't set, then fio will abort if a job exists that would write
to a mounted device or partition.

Signed-off-by: Jens Axboe <>
8 years agoAdd start of mount check
Jens Axboe [Fri, 22 May 2015 03:19:14 +0000 (21:19 -0600)]
Add start of mount check

For raw block devices, lets add some safety check that will check for
destructive tests whether a device is mounted or not. Will plumb this
in soon, and add an override option to continue regardless.

Signed-off-by: Jens Axboe <>
8 years agoMerge branch 'req4' of git://
Jens Axboe [Sat, 16 May 2015 02:13:58 +0000 (20:13 -0600)]
Merge branch 'req4' of git://

8 years agoAdd missing fio_mutex_up() on return
Tomohiro Kusumi [Sat, 16 May 2015 01:10:57 +0000 (10:10 +0900)]
Add missing fio_mutex_up() on return

Call fio_mutex_up() before returning from this function.

8 years agoCleanup DragonFlyBSD support
Tomohiro Kusumi [Sat, 16 May 2015 01:17:14 +0000 (10:17 +0900)]
Cleanup DragonFlyBSD support

Remove these define/undef since fio compiles on DragonFlyBSD
without them.

<sys/rb.h> seems to have never existed in DragonFlyBSD history,
and it compiles without these define/undef. It seems this hack
was necessary on some older versions of NetBSD.

8 years agoChange (blank)cpu affinity macros to inline functions
Tomohiro Kusumi [Thu, 14 May 2015 20:10:05 +0000 (05:10 +0900)]
Change (blank)cpu affinity macros to inline functions

gcc warns -Wunused-value on some environments (e.g. BSD) when
the following cpu affinity macros are used in non conditional code.

Also removed #ifdef FIO_HAVE_CPU_AFFINITY in gettime-thread.c
since this variable needs to be visible when calling the function.

gettime-thread.c: In function 'gtod_thread_main':
os/os.h:82:36: warning: statement with no effect [-Wunused-value]
 #define fio_setaffinity(pid, mask) (0)
gettime-thread.c:48:2: note: in expansion of macro 'fio_setaffinity'
  fio_setaffinity(gettid(), fio_gtod_cpumask);

8 years agostat: add comment on why we need return
Jens Axboe [Thu, 14 May 2015 15:25:10 +0000 (11:25 -0400)]
stat: add comment on why we need return

Signed-off-by: Jens Axboe <>
8 years agoFix warning from gmake on BSD
Tomohiro Kusumi [Thu, 14 May 2015 00:36:40 +0000 (09:36 +0900)]
Fix warning from gmake on BSD

stat.c: In function 'block_state_category':
stat.c:514:1: warning: control reaches end of non-void function

8 years agoAdd 'allow_file_create' option
Jens Axboe [Tue, 12 May 2015 15:31:32 +0000 (11:31 -0400)]
Add 'allow_file_create' option

For running certain jobs, it's convenient to tell fio that you never
want it to create files. On Linux, this prevents filling up /dev
with data for cases where the specified block device isn't available.

Signed-off-by: Jens Axboe <>
8 years agoAdd 'per_job_logs' option
Jens Axboe [Mon, 11 May 2015 17:39:36 +0000 (13:39 -0400)]
Add 'per_job_logs' option

If set, this generates bw/clat/iops log with per file private
filenames. If not set, jobs with identical names will share the
log filename. Default: true.

Signed-off-by: Jens Axboe <>
8 years agoworkqueue: style cleanup
Jens Axboe [Sun, 10 May 2015 17:16:40 +0000 (11:16 -0600)]
workqueue: style cleanup

Signed-off-by: Jens Axboe <>
8 years agoMerge branch 'master' of ssh://
Jens Axboe [Fri, 8 May 2015 15:21:17 +0000 (09:21 -0600)]
Merge branch 'master' of ssh://

8 years agorandom: document default seed value
Jens Axboe [Fri, 8 May 2015 15:19:25 +0000 (09:19 -0600)]
random: document default seed value

Instead of hard coding this in the source, just set the default
value for the 'randseed' option'. Then it's visible when looked
up through --cmdhelp=randseed.

Also document that randrepeat is on by default in the HOWTO,
only the man page had this information.

Signed-off-by: Jens Axboe <>
8 years agoFio 2.2.8 fio-2.2.8
Jens Axboe [Fri, 8 May 2015 00:19:25 +0000 (18:19 -0600)]
Fio 2.2.8

Signed-off-by: Jens Axboe <>
8 years agoFix Windows installer build: LICENSE is now MORAL-LICENSE
Bruce Cran [Thu, 7 May 2015 22:54:37 +0000 (16:54 -0600)]
Fix Windows installer build: LICENSE is now MORAL-LICENSE

Signed-off-by: Jens Axboe <>