fio.git
2 years agoFio 2.21 fio-2.21
Jens Axboe [Thu, 15 Jun 2017 18:25:03 +0000 (12:25 -0600)]
Fio 2.21

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agosync: add support for write life time hint
Jens Axboe [Wed, 14 Jun 2017 15:55:40 +0000 (09:55 -0600)]
sync: add support for write life time hint

Not documented yet, as the interface may change. This matches
what I currently have implemented on the kernel side.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agobinject: don't use void* for pointer arithmetic (gcc)
Tomohiro Kusumi [Mon, 12 Jun 2017 20:02:11 +0000 (23:02 +0300)]
binject: don't use void* for pointer arithmetic (gcc)

I think gcc extension should be avoided when it can be done by
just changing a pointer type.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
2 years agosplice: don't use void* for pointer arithmetic (gcc)
Tomohiro Kusumi [Mon, 12 Jun 2017 20:02:10 +0000 (23:02 +0300)]
splice: don't use void* for pointer arithmetic (gcc)

I think gcc extension should be avoided when it can be done by
just changing a pointer type.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
2 years agosg: don't use void* for pointer arithmetic (gcc)
Tomohiro Kusumi [Mon, 12 Jun 2017 20:02:09 +0000 (23:02 +0300)]
sg: don't use void* for pointer arithmetic (gcc)

I think gcc extension should be avoided when it can be done by
just changing a pointer type.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
2 years agosg: drop redundant void* cast
Tomohiro Kusumi [Mon, 12 Jun 2017 20:02:08 +0000 (23:02 +0300)]
sg: drop redundant void* cast

No need to cast to void*.
This is the only void* cast for memcpy(3) in the entire fio.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
2 years agosg: drop unneeded strdup from ->errdetails() handler
Tomohiro Kusumi [Mon, 12 Jun 2017 20:02:07 +0000 (23:02 +0300)]
sg: drop unneeded strdup from ->errdetails() handler

*ret as well as strdup aren't really necessary, but only make the code
complicated as shown in the previous commit. No functional change.

This commit includes reverting of the previous commit.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
2 years agosg: add missing free(msg); in ->errdetails() handler
Tomohiro Kusumi [Mon, 12 Jun 2017 20:02:06 +0000 (23:02 +0300)]
sg: add missing free(msg); in ->errdetails() handler

msg gets malloc'd unconditionally, so we need to free msg if we're
not using msg for ret (strdup isn't really needed here to begin with).

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
2 years agoman: Update buffer_pattern entry in man pages
Stephen Bates [Thu, 8 Jun 2017 18:10:10 +0000 (12:10 -0600)]
man: Update buffer_pattern entry in man pages

Update the fio man page to reflect the new usage of buffer_pattern.

Signed-off-by: Stephen Bates <sbates@raithlin.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
2 years agooslib/strndup: cleanup and remember to include for aux programs
Jens Axboe [Thu, 8 Jun 2017 16:07:55 +0000 (10:07 -0600)]
oslib/strndup: cleanup and remember to include for aux programs

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoconfigure: remember to initialize 'strndup' to "no"
Jens Axboe [Thu, 8 Jun 2017 15:58:40 +0000 (09:58 -0600)]
configure: remember to initialize 'strndup' to "no"

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoAdd strndup() function, if we don't have it
Jens Axboe [Thu, 8 Jun 2017 15:37:52 +0000 (09:37 -0600)]
Add strndup() function, if we don't have it

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agopattern: Add support for files in buffer_pattern argument.
Stephen Bates [Thu, 8 Jun 2017 11:46:46 +0000 (05:46 -0600)]
pattern: Add support for files in buffer_pattern argument.

It is useful to be able to initialize the buffer contents using an
input file (e.g. when testing certain pathological patterns for
compression). Add support to the buffer_pattern input argument for
reading data from a file via enclosing the filename in ``''``.

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-By: Muli Ben-Yehuda <muli@lightbitslabs.com>
Signed-off-by: Stephen Bates <sbates@raithlin.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
2 years agoHOWTO: mention some details of ignore_error= option
Tomohiro Kusumi [Wed, 7 Jun 2017 20:18:49 +0000 (23:18 +0300)]
HOWTO: mention some details of ignore_error= option

ignore_error= and continue_on_error= are related in their
implementation, and easier to understand how they differ by
mentioning to it.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
2 years agouse ARRAY_SIZE() for ignore_error_nr[etype]
Tomohiro Kusumi [Wed, 7 Jun 2017 20:18:48 +0000 (23:18 +0300)]
use ARRAY_SIZE() for ignore_error_nr[etype]

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
2 years agouse enum error_type_bit for ignore_error index
Tomohiro Kusumi [Wed, 7 Jun 2017 20:18:47 +0000 (23:18 +0300)]
use enum error_type_bit for ignore_error index

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
2 years agodon't leave ignore_error_nr[etype] with 4 on blank input or error
Tomohiro Kusumi [Wed, 7 Jun 2017 20:18:46 +0000 (23:18 +0300)]
don't leave ignore_error_nr[etype] with 4 on blank input or error

This isn't a bug since td_non_fatal_error() checks errnos to ignore
by td->o.ignore_error[etype] being NULL or not, but it's still strange
to leave td->o.ignore_error_nr[etype] with 4 (or multiple of 4 on
error) when there aren't any.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
2 years agofix wrong malloc size for ignore_error buffer
Tomohiro Kusumi [Wed, 7 Jun 2017 20:18:45 +0000 (23:18 +0300)]
fix wrong malloc size for ignore_error buffer

This is supposed to be allocating the initial buffer which consists
of 4 integers to store errno values to ignore.
Also explicitly zero clear the buffer.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
2 years agoblktrace: ensure that dev loop doesn't truncate name
Jens Axboe [Wed, 7 Jun 2017 16:46:40 +0000 (10:46 -0600)]
blktrace: ensure that dev loop doesn't truncate name

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agodiskutil: ensure we have enough room to not write past end
Jens Axboe [Wed, 7 Jun 2017 16:45:46 +0000 (10:45 -0600)]
diskutil: ensure we have enough room to not write past end

gcc 7.1 triggers this warning:

diskutil.c: In function ‘find_block_dir’:
diskutil.c:371:22: warning: ‘__builtin___sprintf_chk’ may write a terminating nul past the end of the destination [-Wformat-overflow=]
   sprintf(full_path, "%s/%s", path, dir->d_name);
                      ^~~~~~~
In file included from /usr/include/stdio.h:936:0,
                 from diskutil.c:1:

Ensure that it's 256+1 in length.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoFix up some style
Jens Axboe [Wed, 7 Jun 2017 14:52:47 +0000 (08:52 -0600)]
Fix up some style

The offset-as-percent was a little different than what we usually
do, clean it up.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agofileset: fix double addition of file offset
Jens Axboe [Wed, 7 Jun 2017 14:48:05 +0000 (08:48 -0600)]
fileset: fix double addition of file offset

The offset-as-percentage patch inadvertently screwed up the regular
offset path, fix that up.

Fixes: 89978a6b26f8 ("allow a percent value for the offset parameter")
Fixes: https://github.com/axboe/fio/issues/382
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agostat: correct json 'io_bytes' output
Jens Axboe [Mon, 5 Jun 2017 20:05:43 +0000 (14:05 -0600)]
stat: correct json 'io_bytes' output

Since the dawn of time, this has outputted kilobytes, not bytes.
Correct this oversight, and also add a 'io_kbytes' key that shows
the old output.

Fixes: 378
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoMerge branch 'more-minimal-info-in-docs' of https://github.com/ianchakeres/fio
Jens Axboe [Mon, 5 Jun 2017 16:54:04 +0000 (10:54 -0600)]
Merge branch 'more-minimal-info-in-docs' of https://github.com/ianchakeres/fio

2 years agoAdded information about minimal output to documentation
Ian Chakeres [Mon, 5 Jun 2017 16:02:06 +0000 (09:02 -0700)]
Added information about minimal output to documentation

Specifically, add a single line that contains a single word short-name for each of the fields included in the terse minimal output.

This information can be used in conjunction with minimal output to more easily identify which results are associated with which field.

2 years agoMerge branch 'master' of https://github.com/cbwest3/fio
Jens Axboe [Mon, 5 Jun 2017 15:36:23 +0000 (09:36 -0600)]
Merge branch 'master' of https://github.com/cbwest3/fio

2 years agoallow a percent value for the offset parameter
Brantley West [Tue, 16 May 2017 21:10:05 +0000 (17:10 -0400)]
allow a percent value for the offset parameter

2 years agoMerge branch 'size_perc' of https://github.com/sitsofe/fio
Jens Axboe [Mon, 5 Jun 2017 15:26:56 +0000 (09:26 -0600)]
Merge branch 'size_perc' of https://github.com/sitsofe/fio

3 years agofilesetup: fix size percentage calculations when using offset
Sitsofe Wheeler [Sun, 4 Jun 2017 07:22:08 +0000 (08:22 +0100)]
filesetup: fix size percentage calculations when using offset

"When an fio job uses a non-zero offset value and a non-zero size
parameter, the working set size on disk is skewed. For a 64k file, the
job provided touches the following blocks:

dd if=/dev/zero of=/tmp/fiofile bs=64k count=1
fio --stonewall --filename=/tmp/fiofile --rw=write \
    --name=firstquarter  --size=25% --offset=0   --buffer_pattern=0x11 \
    --name=secondquarter --size=25% --offset=16k --buffer_pattern=0x22 \
    --name=thirdquarter  --size=25% --offset=32k --buffer_pattern=0x33

|1111111111111111|222222222222----|33333333--------|----------------|
0                16k              32k              48k              64k

1=written by firstquarter, 2=written by secondquarter, 3=written by
thirdquarter

It seems the expected vs. actual math on working set size is
(size_param_percent * size_of_file) vs.
(size_param_percent * (size_of_file - offset))."

Fix this by always calculating the percentage of the full file's size.
Also bound the I/O to be within the existing file's size when using a
size percentage to handle the case where the addition of an offset would
otherwise force I/O to go beyond the existing file size e.g.:

dd if=/dev/zero of=/tmp/fiofile bs=64k count=1
fio --stonewall --filename=/tmp/fiofile --rw=write \
    --name=beyond --size=100% --offset=32k --buffer_pattern=0x11

In the above, we ensure we only do 32k of I/O (rather than the 64k
implied by size=100%).

Fixes: https://github.com/axboe/fio/issues/377 ("Non-zero offset and
non-zero size skew disk working set size")

Reported-by: Brantley West <cbwest@gmail.com>
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
3 years agouse correct syscall name in log_err()
Tomohiro Kusumi [Fri, 2 Jun 2017 19:21:27 +0000 (22:21 +0300)]
use correct syscall name in log_err()

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agouse true/false for bool type
Tomohiro Kusumi [Fri, 2 Jun 2017 19:21:26 +0000 (22:21 +0300)]
use true/false for bool type

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agomanpage: update URL links to HOWTO/README
Tomohiro Kusumi [Fri, 26 May 2017 19:25:11 +0000 (22:25 +0300)]
manpage: update URL links to HOWTO/README

Web frontend of the official git repository seems to have been changed
after 9040e236 (manpage: Add URL links to HOWTO/README).

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoverify: mention some default option values
Tomohiro Kusumi [Fri, 26 May 2017 19:25:10 +0000 (22:25 +0300)]
verify: mention some default option values

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoverify: add missing free(ptr);
Tomohiro Kusumi [Fri, 26 May 2017 19:25:09 +0000 (22:25 +0300)]
verify: add missing free(ptr);

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agolib/output_buffer: harden buf_output_free() and kill buf_output_clear()
Jens Axboe [Wed, 24 May 2017 16:21:27 +0000 (10:21 -0600)]
lib/output_buffer: harden buf_output_free() and kill buf_output_clear()

The clear is superfluous. Kill the caller and the function.

Ensure that we leave the output buffer in a sane state, once
buf_output_free() has been called on it.

Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agolog: unify the logging handlers
Jens Axboe [Wed, 24 May 2017 16:15:20 +0000 (10:15 -0600)]
log: unify the logging handlers

Just provide one handler that does the va args and buffer
printing/allocation, and make the rest of them use that.

Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agolog: ensure we don't truncate the final '\0' in the log
Jens Axboe [Wed, 24 May 2017 03:51:59 +0000 (21:51 -0600)]
log: ensure we don't truncate the final '\0' in the log

Fixes: 7d64aa48 ("log: make the logging functions handle > 1024 bytes correctly")
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agolog: make the logging functions handle > 1024 bytes correctly
Jens Axboe [Wed, 24 May 2017 03:45:31 +0000 (21:45 -0600)]
log: make the logging functions handle > 1024 bytes correctly

We simply truncate the output if it's larger than our static
buffer. Make it dynamically allocated instead, and ensure that
we loop correctly to handle the full amount asked for.

This fixes a problem with truncated output. One example is
json output, with file names (for multiple files) that are
larger than 1024 bytes. With the truncated output, we would
truncate the file name and hence also miss the terminating
'"'. The latter means the json was no longer valid, either.

Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agolog: make log_buf() return how much it wrote
Jens Axboe [Wed, 24 May 2017 03:43:44 +0000 (21:43 -0600)]
log: make log_buf() return how much it wrote

Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoMove Linux/ppc64 specific cpu_online() to os/os-linux.h
Tomohiro Kusumi [Tue, 23 May 2017 18:44:49 +0000 (21:44 +0300)]
Move Linux/ppc64 specific cpu_online() to os/os-linux.h

cpu_online() implementation for ppc64 added to os/os.h by c5dd5d97
(powerpc: fix cpus_online() to get correct max CPU number for powerpc64)
seems Linux specific, thus it should be moved to os/os-linux.h.

For example, non standard sysconf values _SC_NPROCESSORS_ONLN and
_SC_NPROCESSORS_CONF do the same thing with libc in FreeBSD, whereas
they aren't always the same with glibc. This implies c5dd5d97 is about
Linux, and wouldn't be a general solution that needs to be in os/os.h.

sysconf(3) in FreeBSD
https://github.com/freebsd/freebsd/blob/master/lib/libc/gen/sysconf.c#L588

Another possibility is AIX in addition to Linux, but below website
has an example of both _SC_NPROCESSORS_ONLN and _SC_NPROCESSORS_CONF
having the same value under SMT.

Topic: prtconf and sysconf produce different numbers of processors
https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014250083
Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoInclude sg headers in os/os-linux.h
Tomohiro Kusumi [Tue, 23 May 2017 18:44:48 +0000 (21:44 +0300)]
Include sg headers in os/os-linux.h

Since sg is Linux kernel's SCSI subsystem specific interface, it's
better to include required headers in os/os-linux.h which also defines
FIO_HAVE_SGIO, rather than conditionally including them in os/os.h.
Android has FIO_HAVE_SGIO disabled, so no need to do this for Android.

Even if another platform implements sg (compatible) ioctls within
their SCSI driver, there is no guarantee the required kernel header
will be "linux/fs.h", which then fails to compile.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoDrop circular dependency in log.c and lib/output_buffer.c
Tomohiro Kusumi [Tue, 23 May 2017 18:44:47 +0000 (21:44 +0300)]
Drop circular dependency in log.c and lib/output_buffer.c

Two files log.c and lib/output_buffer.c have dependency on each other,
i.e. log.c is using buf_output_add() in lib/output_buffer.c, while
lib/output_buffer.c is using log_info_buf() in log.c.

This commit removes this dependency from lib/output_buffer.c by
dropping log_info_buf() call from a library function buf_output_flush(),
and then as a result rename buf_output_flush() to buf_output_clear()
since it's no longer flusing anything. log_info_buf() is now called
independently by __show_run_stats() which was the only caller of
buf_output_flush().

log_info_buf() returning 0 on !len is necessary to keep this commit
without making functional difference. dprint()/log_info() basically
never pass NULL or "" to log_info_buf(), but __show_run_stats() would
pass NULL with length 0 for unused output modes which then needs to
be avoided as a special case.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoDrop struct thread_data dependency from os headers
Tomohiro Kusumi [Tue, 23 May 2017 18:44:46 +0000 (21:44 +0300)]
Drop struct thread_data dependency from os headers

Since os/os.h is included by fio.h before other functions/structures
are even defined, it's better for os/os*.h not to have dependency on
those (in this case it's struct thread_data and duplicated td_fill_
rand_seeds() prototypes) unless really needed. os/os*.h are basically
collections of small wrappers over syscalls/etc whose idea is similar
but with difference interface among supported platforms, thus they
normally don't need to have dependency on fio functions/structures,
and in fact they're normally designed that way.

This commit gets rid of struct thread_data argument from an inlined
function init_random_state(), which was needed only to call another
function td_fill_rand_seeds(td). This can simply be called from
setup_random_seeds() after init_random_state() without making any
functional difference. Also rename init_random_state() to
init_random_seeds() as it only initializes random seeds now.

With this commit, struct thread_data is completely gone from os/.
struct fio_file is still there, but this is needed by Windows where
the idea of fd differs from unix like in general.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoMove {is,load}_blktrace() to a new header blktrace.h
Tomohiro Kusumi [Tue, 23 May 2017 18:44:45 +0000 (21:44 +0300)]
Move {is,load}_blktrace() to a new header blktrace.h

This commit does exactly the same as what cgroup.h does for cgroup
support.

Since blktrace is Linux specific feature and api compiled only on
Linux and Android, these two could be defined in blktrace.h rather
than in os/os.h which is basically intended to be something generic
whose implementation vary depending on supported platforms.

The reason for adding a new header blktrace.h instead of using
blktrace_api.h is because blktrace_api.h seems to have been added
for blktrace.c to include which gets compiled only on Linux where
blktrace apis are basically guaranteed to exist (unless really old
kernels), whereas these prototypes or inline functions are needed
by all platforms.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoconfigure: Add print_config() for "<config>... <yes|no>" outputs
Tomohiro Kusumi [Tue, 23 May 2017 18:43:58 +0000 (21:43 +0300)]
configure: Add print_config() for "<config>... <yes|no>" outputs

Hide alignment detail (30 spaces between two columns) from callers.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoconfigure: Use single square brackets (POSIX)
Tomohiro Kusumi [Tue, 23 May 2017 18:43:57 +0000 (21:43 +0300)]
configure: Use single square brackets (POSIX)

Avoid "if [[...]]" format which seems to be bash extension.
The script uses "if [...]" except for this one.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoRevert "Fixed json_print_value so that ending double quote of JSON string value will...
Jens Axboe [Wed, 24 May 2017 01:59:28 +0000 (19:59 -0600)]
Revert "Fixed json_print_value so that ending double quote of JSON string value will not disappear"

This reverts commit 002e57665ed7eebe920de6f1729ef2e403b7c6cc.

This commit breaks client/server with json output, since buf == NULL
for that case.

3 years agoMerge branch 'bugfix' of https://github.com/YukiKita/fio
Jens Axboe [Mon, 22 May 2017 16:23:25 +0000 (10:23 -0600)]
Merge branch 'bugfix' of https://github.com/YukiKita/fio

3 years agoMerge branch 'android_cgroup' of https://github.com/omor1/fio
Jens Axboe [Mon, 22 May 2017 16:22:46 +0000 (10:22 -0600)]
Merge branch 'android_cgroup' of https://github.com/omor1/fio

3 years agoMerge branch 'alignment' of https://github.com/sitsofe/fio
Jens Axboe [Mon, 22 May 2017 16:18:15 +0000 (10:18 -0600)]
Merge branch 'alignment' of https://github.com/sitsofe/fio

Commit dbf285f75b4a ("fio: fix some struct alignment issues")
modified some structs we pass over the wire, so we need to
bump the protocol version.

3 years agoserver: bump protocol version
Sitsofe Wheeler [Mon, 22 May 2017 16:14:14 +0000 (17:14 +0100)]
server: bump protocol version

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
3 years agofio: fix some struct alignment issues
Sitsofe Wheeler [Sat, 20 May 2017 17:41:35 +0000 (18:41 +0100)]
fio: fix some struct alignment issues

Fix unaligned/misaligned accesses related to struct thread_stat and
struct jobs_eta seen when running a build produced by
CC=~/clang-3.9/build/bin/clang ./configure --disable-optimizations \
   --extra-cflags="-D__compiler_offsetof=__builtin_offsetof \
   -fsanitize=undefined"

and add to the compile time asserts to make these problems more visible.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
3 years agoFix typo in man page / HOWTO for block size defaults
Jens Axboe [Mon, 22 May 2017 14:52:58 +0000 (08:52 -0600)]
Fix typo in man page / HOWTO for block size defaults

One 'writes' should be 'trims', same error in both places.

Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoMerge branch 'alignment' of https://github.com/omor1/fio
Jens Axboe [Mon, 22 May 2017 14:44:29 +0000 (08:44 -0600)]
Merge branch 'alignment' of https://github.com/omor1/fio

3 years agoMerge branch 'android-26-shm' of https://github.com/omor1/fio
Jens Axboe [Mon, 22 May 2017 14:43:38 +0000 (08:43 -0600)]
Merge branch 'android-26-shm' of https://github.com/omor1/fio

3 years agoos/os-android.h: fix compilation for Android O
Omri Mor [Mon, 22 May 2017 07:13:10 +0000 (00:13 -0700)]
os/os-android.h: fix compilation for Android O

Signed-off-by: Omri Mor <omor1@asu.edu>
3 years agoos/os-android.h: fix alignment problems in shared memory functions
Omri Mor [Mon, 22 May 2017 05:17:08 +0000 (22:17 -0700)]
os/os-android.h: fix alignment problems in shared memory functions
Fixes: #356 ("Android: SIGBUS due to unaligned access")

Signed-off-by: Omri Mor <omor1@asu.edu>
3 years agoconfigure: fix _Static_assert check
Omri Mor [Mon, 22 May 2017 00:43:01 +0000 (17:43 -0700)]
configure: fix _Static_assert check

Signed-off-by: Omri Mor <omor1@asu.edu>
3 years agoAndroid: add support for cgroups
Omri Mor [Sat, 20 May 2017 09:09:45 +0000 (02:09 -0700)]
Android: add support for cgroups

Signed-off-by: Omri Mor <omor1@asu.edu>
3 years agoflist.h: replace offsetof macros by stddef.h include
Omri Mor [Sat, 20 May 2017 08:55:34 +0000 (01:55 -0700)]
flist.h: replace offsetof macros by stddef.h include

Signed-off-by: Omri Mor <omor1@asu.edu>
3 years agoFio 2.20 fio-2.20
Jens Axboe [Fri, 19 May 2017 14:25:27 +0000 (08:25 -0600)]
Fio 2.20

Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agostat: Re-add output of basic bw information if bw_log is not written
Andreas Herrmann [Fri, 19 May 2017 14:09:27 +0000 (16:09 +0200)]
stat: Re-add output of basic bw information if bw_log is not written

Starting with 9e4438f ("stat: don't trust per_unit_log() if log is
NULL") fio no longer provides basic bw information (e.g. min, max,
p_agg, mean, stdev) when write_bw_log is not used. Thus you have to
write a bw_log to obtain these values. (But in this case you can
compute those values yourself.) I think this doesn't make sense.  Not
writing entire bw log shouldn't prevent general sampling and
calculation of bw stats.

This patch reactivates sampling for bw and iops to be able to
calculate basic stats for both independend of writing of entire
{bw,iops}_logs.

Also check for log that is really of interest in __add_samples() it
doesn't make sense to check for bw_log if iops information needs to be
written.

Signed-off-by: Andreas Herrmann <aherrmann@suse.com>
Fixes: 9e4438f ("stat: don't trust per_unit_log() if log is NULL")
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoRemove leftover warnings
Jens Axboe [Thu, 18 May 2017 18:53:38 +0000 (12:53 -0600)]
Remove leftover warnings

Previous commit that fixed up the preadv2/pwritev2 wrappers
left some debug #warning in there by accident. Kill them.

Fixes: 7b5c648f6a5c ("Fix wrap issue with 64-bit pwritev2/preadv2")
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoFix wrap issue with 64-bit pwritev2/preadv2
Jens Axboe [Thu, 18 May 2017 17:59:09 +0000 (11:59 -0600)]
Fix wrap issue with 64-bit pwritev2/preadv2

Apparently I missed that Linux does a clever trick to optimize
how we pass in lo/hi offsets for 64-bit, and it encodes the
full offset in just the low part. This caused corruption when
writing with pwritev2 for laver sizes, and bad data for preadv2
for larger sizes.

Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoFixed json_print_value so that ending double quote of JSON string value will not...
YukiKita [Wed, 17 May 2017 00:05:29 +0000 (09:05 +0900)]
Fixed json_print_value so that ending double quote of JSON string value will not disappear

3 years agoman page: include reference to version 4 of the terse format
Jens Axboe [Wed, 10 May 2017 03:08:12 +0000 (21:08 -0600)]
man page: include reference to version 4 of the terse format

Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agooptions: force refill_buffers with pattern and any reads
Jens Axboe [Thu, 4 May 2017 14:43:27 +0000 (08:43 -0600)]
options: force refill_buffers with pattern and any reads

This will cause writes to always refill the buffer, which is needed
to avoid having the reads garble the contents.

Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agogettime: make utime_since_now and mtime_since_now consistent in how they record the...
Vincent Fu [Sun, 16 Apr 2017 19:04:28 +0000 (15:04 -0400)]
gettime: make utime_since_now and mtime_since_now consistent in how they record the caller and put this all behind FIO_DEBUG_TIME

Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoclient/server: make sure that all elements in io_u_lat_m[] are transferred and received
Vincent Fu [Sun, 16 Apr 2017 19:04:27 +0000 (15:04 -0400)]
client/server: make sure that all elements in io_u_lat_m[] are transferred and received

FIO_IO_U_LAT_U_NR is 10 whereas FIO_IO_U_LAT_M_NR is 12. So we must iterate
over io_u_lat_u and io_u_lat_m separately.

Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agostat: reset_io_stats: fix a problem, rearrange some code
Vincent Fu [Sun, 16 Apr 2017 19:04:26 +0000 (15:04 -0400)]
stat: reset_io_stats: fix a problem, rearrange some code

1) Make sure all the io_u_lat_u/m are reset
2) Only need to zero out total_submit/complete once
3) Reset total/short/drop_io_u inside the other loop that iterates over data directions

Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoRevert "tools/fio_latency2csv.py: add tool that converts json+ to CSV"
Vincent Fu [Sun, 16 Apr 2017 19:04:24 +0000 (15:04 -0400)]
Revert "tools/fio_latency2csv.py: add tool that converts json+ to CSV"

This reverts commit 6cd4d583c75042bf1edd3d2d5c6626883755bfe4.
The script is no longer needed because the json+ output format now
automatically does the transformation carried out by the script.

Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agostat: change json+ output format so that instead of printing the raw clat data struct...
Vincent Fu [Sun, 16 Apr 2017 19:04:23 +0000 (15:04 -0400)]
stat: change json+ output format so that instead of printing the raw clat data structure, use actual durations instead of array indices and print only bins with nonzero counts

Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoMerge branch 'wip-remove-disconnect' of https://github.com/liupan1111/fio
Jens Axboe [Wed, 3 May 2017 14:14:09 +0000 (08:14 -0600)]
Merge branch 'wip-remove-disconnect' of https://github.com/liupan1111/fio

3 years agoremove redundant _fio_rbd_disconnect, which is already called in
Pan Liu [Wed, 3 May 2017 11:20:14 +0000 (19:20 +0800)]
remove redundant _fio_rbd_disconnect, which is already called in
fio_rbd_cleaup

Signed-off-by: Pan Liu <wanjun.lp@alibaba-inc.com>
3 years agoremove out-of-date comment
Pan Liu [Wed, 3 May 2017 11:18:14 +0000 (19:18 +0800)]
remove out-of-date comment

Signed-off-by: Pan Liu <wanjun.lp@alibaba-inc.com>
3 years agoconfigure: Add missing $val != "yes" test to override compile_prog() result
Tomohiro Kusumi [Mon, 1 May 2017 18:48:19 +0000 (21:48 +0300)]
configure: Add missing $val != "yes" test to override compile_prog() result

Since it's possible for some platforms to use statically configured
configurations (e.g. see around L350 for Cygwin), it should test if
the variable hasn't been set to "yes" before initializing the variable
with "no", so that compile_prog() result can be safely ignored when
the platform knows it's supported.

ca205a75 (configure: Make Cygwin take regular configure path) started
this due to a major change in the configuration path, which changed
Cygwin to take the normal path taken by all other platforms, and
these two were added after that change.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoconfigure: Add missing ##########...
Tomohiro Kusumi [Mon, 1 May 2017 18:48:18 +0000 (21:48 +0300)]
configure: Add missing ##########...

And remove unneeded blank lines from embedded test C code.
Both are just for better readability.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoconfigure: Check gfio test result via return value (not printf)
Tomohiro Kusumi [Mon, 1 May 2017 18:48:17 +0000 (21:48 +0300)]
configure: Check gfio test result via return value (not printf)

Test code compiled by compile_prog() mostly return 0 on success
whether binaries are executed or not. This one actually runs and
the result can be checked without printf.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoconfigure: Add void* cast to avoid bogus warning
Tomohiro Kusumi [Mon, 1 May 2017 18:48:16 +0000 (21:48 +0300)]
configure: Add void* cast to avoid bogus warning

This warning has nothing to do with what the code is trying to test.
This test code should keep it volatile, so cast to void* to silence
a warning on discarding volatile.

--
 # uname
 Linux
 # grep memset config.log -A2 | head -3
 /tmp/fio-conf-15226-60011-1419.c:6:10: warning: passing argument 1 of 'memset' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
    memset(&cid, 0, sizeof(cid));
           ^

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoconfigure: Add missing <string.h> to avoid bogus warning
Tomohiro Kusumi [Mon, 1 May 2017 18:48:15 +0000 (21:48 +0300)]
configure: Add missing <string.h> to avoid bogus warning

This warning has nothing to do with what the code is trying to test.
This isn't testing if memset(3) is available, so just silence the
warning by including an appropriate header.

--
 # uname
 Linux
 # grep memset config.log -A2 | head -3
 /tmp/fio-conf-23441-58170-6422.c:5:3: warning: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
    memset(&cid, 0, sizeof(cid));
    ^~~~~~

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoconfigure: output_sym CONFIG_GFIO
Tomohiro Kusumi [Mon, 1 May 2017 18:48:14 +0000 (21:48 +0300)]
configure: output_sym CONFIG_GFIO

No reason not to output_sym CONFIG_GFIO, when all others do this.
Having CONFIG_GFIO in config-host.h doesn't harm anything.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoos/os-android.h: fix shared memory support
Omri Mor [Mon, 1 May 2017 00:09:22 +0000 (17:09 -0700)]
os/os-android.h: fix shared memory support

Fixes: #352 ("Android and shared memory")
Signed-off-by: Omri Mor <omor1@asu.edu>
3 years agoDrop triple X for cpu affinity for OpenBSD
Tomohiro Kusumi [Sun, 30 Apr 2017 17:41:00 +0000 (20:41 +0300)]
Drop triple X for cpu affinity for OpenBSD

(Sorry, resending this as gmail refused an email title including triple X)

This isn't really a fio's TODO item since no such thing seems to
exist (or have existed) in OpenBSD as of 2017, according to below
reference.

NetBSD is in more or less similar situation, except that NetBSD
has pthread_[gs]etaffinity_np() for threads, though it has another
problem that they don't take pid/tid.

CPU affinity comes to OpenBSD (2009)
http://undeadly.org/cgi?action=article&sid=20090324210236

tedu old comment about cpu affinity. (2012)
http://openbsd-archive.7691.n7.nabble.com/tedu-old-comment-about-cpu-affinity-tt172330.html

how to use cpu affinity from user space (2013)
http://openbsd-archive.7691.n7.nabble.com/how-to-use-cpu-affinity-from-user-space-td222323.html

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoImplement shm_attach_to_open_removed() for OpenBSD
Tomohiro Kusumi [Sun, 30 Apr 2017 17:35:10 +0000 (20:35 +0300)]
Implement shm_attach_to_open_removed() for OpenBSD

Add implementation which had been left by
0cfe2089 (Add runtime handlers for 97900ebf for FreeBSD/DragonFlyBSD).

This implementation is based on what
97900ebf (shm: have os remove shared memory if fio dies unexpectedly)
says. There seems to be no easy way to statically test versions like
KERNEL_VERSION() in Linux kernel.

The code assumes major/minor are both < 10. The minor has never been
10 or above. The major won't be 10 anytime soon based on the past
release cycle (current version is 6.1 after more than 2 decades).
https://en.wikipedia.org/wiki/OpenBSD_version_history

--
 # uname
 OpenBSD
 # uname -r
 6.1
 # cat ./test1.c
 #include <stdio.h>
 #include "./os/os.h"
 #include "./os/os-openbsd.h"
 int main(void) {
         printf("%d\n", shm_attach_to_open_removed());
         return 0;
 }
 # gcc -Wall -g ./test1.c
 # ./a.out
 1

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoTurn off lex by default on OpenBSD
Tomohiro Kusumi [Sun, 30 Apr 2017 17:35:09 +0000 (20:35 +0300)]
Turn off lex by default on OpenBSD

Do the same as what AIX does. OpenBSD (at least recent ones) hits
below syntax error. Feel free to revert this commit and properly
fix this if possible.

CC y.tab.c
exp/expression-parser.y:68: syntax error
%parse-param { long long *result }
^
gmake: *** [Makefile:341: y.tab.c] Error 1

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoFix "'RB_ROOT' undeclared" error on OpenBSD
Tomohiro Kusumi [Sun, 30 Apr 2017 17:35:08 +0000 (20:35 +0300)]
Fix "'RB_ROOT' undeclared" error on OpenBSD

OpenBSD has below compiler error due to RB_ROOT name conflict between
lib/rbtree.h and OpenBSD header. os/os-{net,open}bsd.h actually have
had a workaround for this by undefing their RB_XXX macros (which fio
doesn't use) for possible conflicts, but then "lib/rbtree.h" needs
to be included after os/os.h which includes os/os-openbsd.h.

t/dedupe.c: In function 'main':
t/dedupe.c:583: error: 'RB_ROOT' undeclared (first use in this function)
t/dedupe.c:583: error: (Each undeclared identifier is reported only once
t/dedupe.c:583: error: for each function it appears in.)

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoFix "C99 inline functions are not supported" warning on OpenBSD
Tomohiro Kusumi [Sun, 30 Apr 2017 17:35:07 +0000 (20:35 +0300)]
Fix "C99 inline functions are not supported" warning on OpenBSD

OpenBSD has below compiler warning due to hist_sum() being inlined.
It should be fine with no inline (or move it to iolog.h with static
if we somehow want to keep it inlined).

iolog.c:702: warning: C99 inline functions are not supported; using GNU89
iolog.c:702: warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoFix "cast from pointer to integer of different size" warning on OpenBSD
Tomohiro Kusumi [Sun, 30 Apr 2017 17:35:06 +0000 (20:35 +0300)]
Fix "cast from pointer to integer of different size" warning on OpenBSD

OpenBSD has below compiler warning due to pthread_t being typedef'd
to struct pthread*.

 os/os-openbsd.h: In function 'gettid':
 os/os-openbsd.h:71: warning: cast from pointer to integer of different size

--
 # uname
 OpenBSD
 # grep pthread_t /usr/include -rI | grep typedef | head -1
 /usr/include/pthread.h:typedef struct   pthread                 *pthread_t;
 # cat ./p1.c
 #include <stdio.h>
 #include <pthread.h>
 int main(void) {
         pthread_t id = 1234;
         printf("%d\n", (int)id);
         return 0;
 }
 # gcc -Wall -g ./p1.c
 ./p1.c: In function 'main':
 ./p1.c:4: warning: initialization makes pointer from integer without a cast
 ./p1.c:5: warning: cast from pointer to integer of different size
 # ./a.out
 1234

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoMerge branch 'zero_ioengine_flags' of https://github.com/sitsofe/fio
Jens Axboe [Sun, 30 Apr 2017 22:49:22 +0000 (16:49 -0600)]
Merge branch 'zero_ioengine_flags' of https://github.com/sitsofe/fio

3 years agoMerge branch 'fix-348' of https://github.com/omor1/fio
Jens Axboe [Sun, 30 Apr 2017 22:48:24 +0000 (16:48 -0600)]
Merge branch 'fix-348' of https://github.com/omor1/fio

3 years agoos/os-linux.h: fix broken byte swap intrinsics
Omri Mor [Sun, 30 Apr 2017 22:25:06 +0000 (15:25 -0700)]
os/os-linux.h: fix broken byte swap intrinsics

Signed-off-by: Omri Mor <omor1@asu.edu>
3 years agoos/os-android.h: use byte swap intrinsics if available
Omri Mor [Sun, 30 Apr 2017 22:23:39 +0000 (15:23 -0700)]
os/os-android.h: use byte swap intrinsics if available

Signed-off-by: Omri Mor <omor1@asu.edu>
3 years agoos/os-android.h: fix broken shmget() due to ndk-r15
Omri Mor [Sun, 30 Apr 2017 21:32:03 +0000 (14:32 -0700)]
os/os-android.h: fix broken shmget() due to ndk-r15

Fixes: #346 ("Compiling for Android using ndk-r15")
Signed-off-by: Omri Mor <omor1@asu.edu>
3 years agofio.h: zero old flag bits when setting new ioengine flags
Sitsofe Wheeler [Sat, 29 Apr 2017 08:46:43 +0000 (09:46 +0100)]
fio.h: zero old flag bits when setting new ioengine flags

Fix a small bug in td_set_ioengine_flags() where it wouldn't zero old
bits in td->flags before setting new flag bits.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
3 years agoconfigure: fix broken test for cuda
Jens Axboe [Wed, 26 Apr 2017 21:24:36 +0000 (15:24 -0600)]
configure: fix broken test for cuda

Fixes: 03553853 ("GPUDirect RDMA support")
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agothread_options: kill two unused pads
Jens Axboe [Wed, 26 Apr 2017 21:22:50 +0000 (15:22 -0600)]
thread_options: kill two unused pads

Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoserver: bump protocol version
Jens Axboe [Wed, 26 Apr 2017 21:06:24 +0000 (15:06 -0600)]
server: bump protocol version

Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agogpu: kill a lot of useless ifdefs
Jens Axboe [Wed, 26 Apr 2017 21:05:07 +0000 (15:05 -0600)]
gpu: kill a lot of useless ifdefs

We just have to guard how we set the mem type, we don't have
to guard any check for MEM_CUDA_MALLOC inside CONFIG_CUDA
ifdefs.

Additionally, fix up some bad style.

Fixes: 03553853 ("GPUDirect RDMA support")
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agogpu: ensure that we convert gpu_dev_id options
Jens Axboe [Wed, 26 Apr 2017 21:04:21 +0000 (15:04 -0600)]
gpu: ensure that we convert gpu_dev_id options

Fixes: 03553853 ("GPUDirect RDMA support")
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoMerge branch 'gpudirect' of https://github.com/yufeiren/fio
Jens Axboe [Wed, 26 Apr 2017 20:54:22 +0000 (14:54 -0600)]
Merge branch 'gpudirect' of https://github.com/yufeiren/fio