fio.git
4 years agoengines/http: set FIO_SYNCIO flag
Vincent Fu [Tue, 9 Jul 2019 14:54:40 +0000 (10:54 -0400)]
engines/http: set FIO_SYNCIO flag

This ioengine carries out synchronous operations. So the FIO_SYNCIO flag
needs to be set in order for latencies to be calculated correctly.

Fixes: https://github.com/axboe/fio/issues/797
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agofio: fix aio trim completion latencies
Vincent Fu [Mon, 8 Jul 2019 19:23:54 +0000 (15:23 -0400)]
fio: fix aio trim completion latencies

The io_uring, libaio, and posixaio ioengines actually carry out
synchronous trim operations, but latency timestamps are recorded as if
the trims were issued asynchronously. This patch fixes how timestamps
are recorded for trim operations issued by these ioengines.

Fixes: https://github.com/axboe/fio/issues/764
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoMerge branch 'optlenmax' of https://github.com/powernap/fio
Jens Axboe [Mon, 1 Jul 2019 20:26:29 +0000 (14:26 -0600)]
Merge branch 'optlenmax' of https://github.com/powernap/fio

* 'optlenmax' of https://github.com/powernap/fio:
  Increase maximum length of line in jobs file to 8192

4 years agoIncrease maximum length of line in jobs file to 8192
Nick Principe [Mon, 1 Jul 2019 19:45:21 +0000 (15:45 -0400)]
Increase maximum length of line in jobs file to 8192

Increase OPT_LEN_MAX to 8192, use OPT_LEN_MAX for string in
__parse_jobs_ini(), and document line length limit for job files in man
page.

Signed-off-by: Nick Principe nick@princi.pe
4 years agoengines/rbd: hide rbd_io_u_seen() if not used
Jens Axboe [Mon, 1 Jul 2019 20:09:23 +0000 (14:09 -0600)]
engines/rbd: hide rbd_io_u_seen() if not used

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoeta: Fix compiler warning
Damien Le Moal [Tue, 4 Jun 2019 07:07:32 +0000 (16:07 +0900)]
eta: Fix compiler warning

gcc 9 complains about directly referencing pointer values in the packed
structure jobs_eta. E.g.:

warning: taking address of packed member of ‘struct jobs_eta’ may
result in an unaligned pointer value [-Waddress-of-packed-member]

Remove this by using a local void pointer for the rate and iops array
references that generate the warning.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoFix string copy compilation warnings
Damien Le Moal [Tue, 4 Jun 2019 07:07:31 +0000 (16:07 +0900)]
Fix string copy compilation warnings

Fix the many warnings that gcc 9 spits out.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoMerge branch 'wip-tcmalloc' of https://github.com/dillaman/fio
Jens Axboe [Fri, 31 May 2019 21:37:18 +0000 (15:37 -0600)]
Merge branch 'wip-tcmalloc' of https://github.com/dillaman/fio

* 'wip-tcmalloc' of https://github.com/dillaman/fio:
  configure: attempt to link against tcmalloc by default if available

4 years agoconfigure: attempt to link against tcmalloc by default if available
Jason Dillaman [Fri, 31 May 2019 20:50:33 +0000 (16:50 -0400)]
configure: attempt to link against tcmalloc by default if available

librbd will run up to 20% faster under small IO workloads when fio is linked
against tcmalloc. By automatically linking against tcmalloc, it avoids
the need to use LD_PRELOAD to pull in a faster memory management toolset.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
4 years agoconfigure: check for gtk version using pkg-config
Helmut Grohne [Mon, 27 May 2019 19:32:57 +0000 (21:32 +0200)]
configure: check for gtk version using pkg-config

The previous way of running a program was incompatible with cross
compilation. The program is still being compiled as a sanity check, but
no longer run.

Signed-off-by: Helmut Grohne <helmut@subdivi.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoconfigure: apply ${cross_prefix} to pkg-config calls
Helmut Grohne [Mon, 27 May 2019 19:32:49 +0000 (21:32 +0200)]
configure: apply ${cross_prefix} to pkg-config calls

Otherwise, we're searching for build architecture libraries which is not
what we want.

Signed-off-by: Helmut Grohne <helmut@subdivi.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoglusterfs: update for new API
Jens Axboe [Thu, 23 May 2019 20:57:03 +0000 (14:57 -0600)]
glusterfs: update for new API

Apparently glusterfs just changes their API as they see fit. Add
a configure check for the newer version, which adds pre/post stat
variables in a few random spots.

This should fix compilation with v6.0 of the API.

Fixes: https://github.com/axboe/fio/issues/781
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoconfigure: add gettid() test
Jens Axboe [Wed, 22 May 2019 23:12:55 +0000 (17:12 -0600)]
configure: add gettid() test

Apparently some newer glibcs now have it, decades after the
fact.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoFio 3.14 fio-3.14
Jens Axboe [Wed, 22 May 2019 19:41:41 +0000 (13:41 -0600)]
Fio 3.14

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoio_uring: sync with liburing/kernel
Jens Axboe [Mon, 20 May 2019 14:49:49 +0000 (08:49 -0600)]
io_uring: sync with liburing/kernel

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agostat: remove terse v2 blank lines with description not set
Vincent Fu [Wed, 15 May 2019 20:05:03 +0000 (16:05 -0400)]
stat: remove terse v2 blank lines with description not set

The documentation says that the job description will appear on a second
line if this is set. If it is not set there will be an empty line.
Eliminate the empty line when the description is not set.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agodocs: improve terse output format documentation
Vincent Fu [Wed, 15 May 2019 20:05:02 +0000 (16:05 -0400)]
docs: improve terse output format documentation

Fix up some details and note client/server mode differences.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoclient: add a newline after terse disk util
Vincent Fu [Wed, 15 May 2019 20:05:01 +0000 (16:05 -0400)]
client: add a newline after terse disk util

In client/server mode terse disk utilization output appears at the end
of each blob of terse output. We need a newline so that the next blob of
terse output starts at the beginning of a line.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoclient: handle disk util for all output formats
Vincent Fu [Wed, 15 May 2019 20:05:00 +0000 (16:05 -0400)]
client: handle disk util for all output formats

Since fio allows multiple output formats, it should process the disk
utilization data for each output format that was requested by the user
when it is run in client/server mode.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoclient: do not print disk utilization for terse v2
Vincent Fu [Wed, 15 May 2019 20:04:59 +0000 (16:04 -0400)]
client: do not print disk utilization for terse v2

terse version 2 omits disk utilization data when fio is run locally.
Make this behavior the same when fio is run in client/server mode.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agot/io_uring: improve EOPNOTSUPP message
Jens Axboe [Thu, 9 May 2019 15:56:29 +0000 (09:56 -0600)]
t/io_uring: improve EOPNOTSUPP message

Put in one line and include kernel as well.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agot/io_uring: clarify polled support is fs + device
Jens Axboe [Wed, 8 May 2019 17:56:05 +0000 (11:56 -0600)]
t/io_uring: clarify polled support is fs + device

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoUpdate CFLAGS and LDFLAGS for FreeBSD builds
Rebecca Cran [Mon, 6 May 2019 22:12:41 +0000 (16:12 -0600)]
Update CFLAGS and LDFLAGS for FreeBSD builds

FreeBSD installs third-party headers into /usr/local/include
and libraries into /usr/local/lib.
Update CFLAGS and LDFLAGS to look there.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoMerge branch 'fix-infinite-loop-of-io_uring' of https://github.com/satoru-takeuchi/fio
Jens Axboe [Mon, 6 May 2019 16:24:24 +0000 (10:24 -0600)]
Merge branch 'fix-infinite-loop-of-io_uring' of https://github.com/satoru-takeuchi/fio

* 'fix-infinite-loop-of-io_uring' of https://github.com/satoru-takeuchi/fio:
  io_uring: fix possible infinite loop

4 years agoio_uring: fix possible infinite loop
Satoru Takeuchi [Sun, 5 May 2019 23:56:36 +0000 (08:56 +0900)]
io_uring: fix possible infinite loop

When reaping some completed I/O before io_uring_enter(), it waits forever.

Signed-off-by: Satoru Takeuchi <sat@cybozu.co.jp>
4 years agoio_uring: remove cachehit information
Jens Axboe [Thu, 25 Apr 2019 19:27:54 +0000 (13:27 -0600)]
io_uring: remove cachehit information

This patch never made it into the upstream kernel, remove knowledge
of it from fio.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoFix __FIO_OPT_G_ISCSI numbering
Jens Axboe [Thu, 25 Apr 2019 16:09:27 +0000 (10:09 -0600)]
Fix __FIO_OPT_G_ISCSI numbering

__FIO_OPT_G_NR must always be last, if it isn't then it doesn't
denote the last used bit.

Fixes: 247ef2aaf28a ("fio: add libiscsi engine")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agozbd random read conventional zones
Phillip Chen [Wed, 24 Apr 2019 21:47:41 +0000 (15:47 -0600)]
zbd random read conventional zones

Initialize conventional zone write pointers to full so
zbd_find_zone will accept conventional zones when searching
around a randomly chosen empty zone.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Phillip Chen <phillip.a.chen@seagate.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoMerge branch 'libiscsi' of https://github.com/smartxworks/fio
Jens Axboe [Mon, 22 Apr 2019 14:38:55 +0000 (08:38 -0600)]
Merge branch 'libiscsi' of https://github.com/smartxworks/fio

* 'libiscsi' of https://github.com/smartxworks/fio:
  fio: add libiscsi engine
  filesetup: don't call create_work_dirs() for ioengine with FIO_DISKLESSIO

4 years agofio: add libiscsi engine
Kyle Zhang [Wed, 10 Apr 2019 11:37:41 +0000 (19:37 +0800)]
fio: add libiscsi engine

Adding a new engine that access iscsi lun with libiscsi.

You could find example fio configuration in examples/libiscsi.fio .

Signed-off-by: Kyle Zhang <kyle@smartx.com>
4 years agofilesetup: don't call create_work_dirs() for ioengine with FIO_DISKLESSIO
Kyle Zhang [Thu, 11 Apr 2019 15:01:55 +0000 (23:01 +0800)]
filesetup: don't call create_work_dirs() for ioengine with FIO_DISKLESSIO

Don't create work dirs if ioengine has flag FIO_DISKLESSIO. So that
filename can contains '/'. It is useful when ioengine is based on
network and filename is used as url.

Also call create_work_dirs() just when setting up a file. So that
ioengine is loaded and ioengine flags are available.

Signed-off-by: Kyle Zhang <kyle@smartx.com>
5 years agozbd: Fix zone report handling
Damien Le Moal [Fri, 19 Apr 2019 03:40:49 +0000 (12:40 +0900)]
zbd: Fix zone report handling

fio may be executed concurrently with a block device revalidation by
the kernel. Device revalidation may lead to the block device capacity
to be changed to a smaller value (device changed) or to even 0 in case
of revalidation failure. In such case, the BLKREPORTZONE ioctl
executed from read_zone_info() may report a success with an empty zone
report when the start sector for the report is above the new capacity
of the device. This leads to an infinite loop inside parse_zone_info()
and the fio run never terminating.

Fix this problem by returning -EIO from read_zone_info() thus
avoiding the infinite loop in parse_zone_info(). This change does not
affect the normal case with a stable device as read_zone_info() is
always called with a valid start sector that does not result in an
empty zone report.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agofio: Add advise THP option to mmap engine
Keith Busch [Thu, 18 Apr 2019 16:25:56 +0000 (10:25 -0600)]
fio: Add advise THP option to mmap engine

The Linux specific transparent hugepage memory advisory has potentially
significant implications for how the memory management behaves. If the
platform supports it, add a new mmap ioengine specific option that advises
HUGEPAGE on an mmap'ed range. The option availability is detected during
configure. If the option is set, fio can test THP when used with private
anonymous memory (i.e. mmap /dev/zero).

Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoMerge branch 'master' of https://github.com/mingnus/fio
Jens Axboe [Wed, 17 Apr 2019 12:50:25 +0000 (06:50 -0600)]
Merge branch 'master' of https://github.com/mingnus/fio

* 'master' of https://github.com/mingnus/fio:
  rand: fix truncated rand_seed on Windows

5 years agorand: fix truncated rand_seed on Windows
Ming-Hung Tsai [Wed, 17 Apr 2019 04:25:10 +0000 (12:25 +0800)]
rand: fix truncated rand_seed on Windows

The long data type is 32-bit on LLP64 platforms

5 years agoMerge branch 'patch-1' of https://github.com/neheb/fio
Jens Axboe [Mon, 1 Apr 2019 12:57:22 +0000 (06:57 -0600)]
Merge branch 'patch-1' of https://github.com/neheb/fio

* 'patch-1' of https://github.com/neheb/fio:
  arch: fix build breakage on armv6 again

5 years agoarch: fix build breakage on armv6 again
Rosen Penev [Mon, 1 Apr 2019 04:19:03 +0000 (21:19 -0700)]
arch: fix build breakage on armv6 again

6K was missing from the defines.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
5 years agostat: eliminate unneeded curly braces
Vincent Fu [Mon, 25 Mar 2019 14:20:28 +0000 (10:20 -0400)]
stat: eliminate unneeded curly braces

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoclient: put All clients section at end of normal output
Vincent Fu [Mon, 25 Mar 2019 14:20:27 +0000 (10:20 -0400)]
client: put All clients section at end of normal output

When fio runs multiple jobs on servers, it is possible for the "All
clients" output to appear in the middle of output for the individual
jobs. This patch puts the "All clients" output into a separate buffer
and displays it after the output for all the individual jobs.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agostat: fix accumulation of latency buckets
Vincent Fu [Thu, 21 Mar 2019 16:45:13 +0000 (12:45 -0400)]
stat: fix accumulation of latency buckets

The numbers of buckets for nsec, usec, and msec latencies may differ
from each other. So we need to iterate separately over the three types
of buckets.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: memset() allocated memory
Keith Busch [Mon, 11 Mar 2019 16:46:47 +0000 (10:46 -0600)]
t/io_uring: memset() allocated memory

But I totally rushed this patch and just sent it once I heard it "worked",
and it really doesn't because malloc doesn't zero the buffer. My mistake,
kzalloc spoiled me. Here's the fix:

Fixes: e39863e3cb61 ("t/io_uring: add depth options")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: add depth options
Keith Busch [Fri, 8 Mar 2019 21:59:59 +0000 (14:59 -0700)]
t/io_uring: add depth options

Make depth options command line parameters so a recompile isn't
required to see how it affects performance.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoengines/skeleton_external: update gcc incantation
Jens Axboe [Thu, 7 Mar 2019 23:54:41 +0000 (16:54 -0700)]
engines/skeleton_external: update gcc incantation

Fixes: https://github.com/axboe/fio/issues/747
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: stop when max number of files is reached
Jens Axboe [Wed, 6 Mar 2019 15:24:38 +0000 (08:24 -0700)]
t/io_uring: stop when max number of files is reached

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoengines/sg: ensure we flag EIO on the right io_u
Jens Axboe [Thu, 28 Feb 2019 17:07:38 +0000 (10:07 -0700)]
engines/sg: ensure we flag EIO on the right io_u

For sync complete, set it on the io_u that corresponds to the hdr
we just read.

Fixes: a999bc49d7aa ("engines/sg: ensure we complete the right command for sync IO")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoengines/sg: ensure we complete the right command for sync IO
Jens Axboe [Thu, 28 Feb 2019 17:04:38 +0000 (10:04 -0700)]
engines/sg: ensure we complete the right command for sync IO

Currently we just read back the first command that completes, and
assume it's the right one. That's totally bogus, we need to keep
going until we find the right completion.

Also only call td_verror() if we have an error, not uncondtionally.

Fixes: https://github.com/axboe/fio/issues/743
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoengines/sg: kill dead function
Jens Axboe [Sun, 24 Feb 2019 15:13:39 +0000 (08:13 -0700)]
engines/sg: kill dead function

This makes clang error out.

Fixes: bc596cbcdbb5 ("t/zbd: Add multi-job libaio test")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/zbd: Add multi-job libaio test
Damien Le Moal [Thu, 21 Feb 2019 04:11:07 +0000 (13:11 +0900)]
t/zbd: Add multi-job libaio test

Introduce test case 46 to verify that write ordering is correct and that
no job deadlock occurs in the case of a multi job run with an
asynchronous I/O engine (libaio).

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agozbd: Avoid async I/O multi-job workload deadlock
Damien Le Moal [Thu, 21 Feb 2019 04:11:06 +0000 (13:11 +0900)]
zbd: Avoid async I/O multi-job workload deadlock

With zonemode=zbd, for a multi-job workload using asynchronous I/O
engines with a deep I/O queue depth setting, a job that is building a
batch of asynchronous I/Os to submit may end up waiting for an I/O
target zone lock held by another job that is also preparing a batch.
For small devices with few zones and/or a large number of jobs, such
prepare phase zone lock contention can be frequent enough to end up in a
situation where all jobs are waiting for zone locks held by other jobs
and no I/O being executed (so no zone being unlocked).

Avoid this situation by using pthread_mutex_trylock() instead of
pthread_mutex_lock() and by calling io_u_quiesce() to execute queued
I/O units if locking fails. pthread_mutex_lock() is then called to
lock the desired target zone. The execution of io_u_quiesce() forces
I/O execution progress and so zones to be unlocked, avoiding job
deadlock.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agozbd: Fix zone locking for async I/O engines
Damien Le Moal [Thu, 21 Feb 2019 04:11:05 +0000 (13:11 +0900)]
zbd: Fix zone locking for async I/O engines

For a zoned block device with zonemode=zbd, the lock on the target zone
of an I/O is held from the time the I/O is prepared with
zbd_adjust_block() execution in fill_io_u() until the I/O is queued in
td_io_queue(). For a sync I/O engines, this means that the target zone
of an I/O operations is locked throughout the liftime of an I/O unit,
resulting in the serialization of write request preparation and
execution, as well as serialization of write operations and reset zone
operations for a zone, avoiding error inducing reordering.

However, in the case of an async I/O engine, the engine ->commit()
method falls outside of the zone lock serialization for all I/O units
that will be issued by the method execution. This results in potential
reordering of write requests during issuing, as well as simultaneous
queueing of write requests and zone reset operations resulting in
unaligned write errors.

For example, using a 1GB null_blk zoned device, the command:

fio --name=nullb0 --filename=/dev/nullb0 --direct=1 --zonemode=zbd
    --bs=4k --rw=randwrite --ioengine=libaio --group_reporting=1
    --iodepth=32 --numjobs=4

always fails due to unaligned write errors.

Fix this by refining the control over zone locking and unlocking.
Locking of an I/O target zone is unchanged and done in
zbd_adjust_block(), but the I/O callback function zbd_post_submit()
which updates a zone write pointer and unlocks the zone is split into
two different callbacks zbd_queue_io() and zbd_put_io().
zbd_queue_io() updates the zone write pointer for write operations and
unlocks the target zone only if the I/O operation was not queued or if
the I/O operation completed during the execution of the engine
->queue() method (e.g. a sync I/O engine is being used). The execution
of this I/O callback is done right after executing the I/O engine
->queue() method. The zbd_put_io() callback is used to unlock an I/O
target zone after completion of an I/O from within the put_io_u()
function.

To simplify the code the helper functions zbd_queue_io_u() and
zbd_put_io_u() which respectively call an io_u zbd_queue_io() and
zbd_put_io() callbacks are introduced. These helper functions are
conditionally defined only if CONFIG_LINUX_BLKZONED is set.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/zbd: Default to using blkzone tool
Shin'ichiro Kawasaki [Thu, 21 Feb 2019 04:11:04 +0000 (13:11 +0900)]
t/zbd: Default to using blkzone tool

The test-zbd-support script fails to execute for partition devices with
the error message "Open /dev/sdX1 failed (No such file or directory)"
when libzbc tools are used by the script to open the specified
partition device. This is due to libzbc also opening a partition holder
block device file, which when closed causes a partition table
revalidation and the partition device files to be deleted and
recreated by udev through the RRPART ioctl.

To avoid the failure, default to using blkzone for zone report and
reset if supported by the system (util-linux v2.30 and higher) as this
tool does not open the older device and avoids the same problem.
To obtain the device maximum number of open zones, which is not
advertized by blkzone, use sg_inq for SCSI devices and use the default
maximum of 128 for other device types (i.e. null_blk devices in zone
mode).

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/zbd: Fix test 2 and 3 result handling
Damien Le Moal [Thu, 21 Feb 2019 04:11:03 +0000 (13:11 +0900)]
t/zbd: Fix test 2 and 3 result handling

Removal of the message "No I/O performed" when fio does not execute any
I/O broke zbd tests 2 and 3 as this message is looked after to test for
success. Fix this by looking for a "Run status" line starting with
"WRITE:" for test 2 and "READ:" for test 3. The run status lines are not
printed when no I/O is performed. Testing for the absence of these
strings thus allows to easily test if I/Os where executed or not.

Fixes: ff3aa922570c ("Kill "No I/O performed by ..." message")
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/zbd: Fix handling of partition devices
Shin'ichiro Kawasaki [Thu, 21 Feb 2019 04:11:02 +0000 (13:11 +0900)]
t/zbd: Fix handling of partition devices

To allow t/zbd/tests-zbd-support test script to run correctly on
partitions of zoned block devices, fix access to the device properties
through sysfs by referencing the sysfs directory of the holder block
device. Doing so, the "zoned", "logical_block_size" and "mq" attributes
can be correctly accessed.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agosg: Clean up handling of big endian data fields
Dmitry Fomichev [Thu, 21 Feb 2019 04:11:01 +0000 (13:11 +0900)]
sg: Clean up handling of big endian data fields

Getting and setting values in SCSI commands and descriptors,
which are big endian, in SG driver can use a bit of cleanup.
This patch simplifies SG driver code by introducing a set of
accessor functions for reading raw big endian values from SCSI
buffers and another set for properly storing the local values
as big endian byte sequences.

The patch also adds some missing endianness conversion macros
in os.h.

Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agosg: Avoid READ CAPACITY failures
Dmitry Fomichev [Thu, 21 Feb 2019 04:11:00 +0000 (13:11 +0900)]
sg: Avoid READ CAPACITY failures

Some SCSI devices (very large disks or SMR zoned disks in particular)
do not support the READ CAPACITY(10) command and only reply
successfully to the READ CAPACITY(16) command. This patch forces the
execution READ CAPACITY(16) if READ CAPACITY(10) fails with
CHECK CONDITION.

Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agozbd: Fix partition block device handling
Shin'ichiro Kawasaki [Thu, 21 Feb 2019 04:10:59 +0000 (13:10 +0900)]
zbd: Fix partition block device handling

For fio to correctly handle the zonemode=zbd mode with partitions of
zoned block devices, the partition block device file must be identified
as a zoned disk. However, partition block device files do not have
a zoned sysfs file. This patch allows a correct identification of the
device file zone model by accessing the sysfs "zoned" file of the
holder disk for partition devices.

Change get_zbd_model() function to resolve the symbolic link to the
sysfs path to obtain the canonical sysfs path. The canonical sysfs
path of a partition device includes both of the holder device name and
the partition device name. If the given device is a partition device,
cut the partition device name in the canonical sysfs path to access
the "zoned" file in the holder device sysfs path.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agooptions: catch division by zero in setting CPU affinity
Vincent Fu [Tue, 19 Feb 2019 21:44:08 +0000 (16:44 -0500)]
options: catch division by zero in setting CPU affinity

Catch a division by zero and abort with a helpful message instead of a
signal 8 floating point error.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agostat: use long doubles to identify latency percentiles
Vincent Fu [Tue, 19 Feb 2019 21:44:07 +0000 (16:44 -0500)]
stat: use long doubles to identify latency percentiles

In some cases, the 100th percentile latency is not correctly identified
because of problems with double precision floating point arithmetic.
Use long doubles instead in the while loop condition to reduce the
likelihood of encountering this problem.

Also, print an error message when latency percentiles are not
successfully identified.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoconfigure: enable -Wimplicit-fallthrough if we have it
Jens Axboe [Mon, 11 Feb 2019 20:30:52 +0000 (13:30 -0700)]
configure: enable -Wimplicit-fallthrough if we have it

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoDocument switch fall-through cases
Jens Axboe [Mon, 11 Feb 2019 18:20:29 +0000 (11:20 -0700)]
Document switch fall-through cases

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoio_uring: sync header with the kernel
Jens Axboe [Sun, 10 Feb 2019 16:36:48 +0000 (09:36 -0700)]
io_uring: sync header with the kernel

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoclient/server: inflate error handling
Jeff Furlong [Fri, 8 Feb 2019 23:33:34 +0000 (16:33 -0700)]
client/server: inflate error handling

Occasionally fio client/server with zlib enabled may report:

fio: inflate error -5
fio: failed decompressing log
fio: failed converting IO log

The error -5 is a Z_BUF_ERROR, and references are available at
https://zlib.net/zlib_how.html and https://www.zlib.net/manual.html  It
seems that when decompressing the buffer, if the buffer chunk is the
same size as remaining data in the buffer, the Z_BUF_ERROR can safely be
ignored.  So one idea is to ignore the safe errors noting the zlib
references:

"inflate() can also return Z_STREAM_ERROR, which should not be possible
here, but could be checked for as noted above for def(). Z_BUF_ERROR
does not need to be checked for here, for the same reasons noted for
def(). Z_STREAM_END will be checked for later.

        ret = inflate(&strm, Z_NO_FLUSH);
        assert(ret != Z_STREAM_ERROR);  /* state not clobbered */
        switch (ret) {
        case Z_NEED_DICT:
            ret = Z_DATA_ERROR;     /* and fall through */
        case Z_DATA_ERROR:
        case Z_MEM_ERROR:
            (void)inflateEnd(&strm);
            return ret;
        }

...

The way we tell that deflate() has no more output is by seeing that it
did not fill the output buffer, leaving avail_out greater than zero.
However suppose that deflate() has no more output, but just so happened
to exactly fill the output buffer! avail_out is zero, and we can't tell
that deflate() has done all it can. As far as we know, deflate() has
more output for us. So we call it again. But now deflate() produces no
output at all, and avail_out remains unchanged as CHUNK. That deflate()
call wasn't able to do anything, either consume input or produce output,
and so it returns Z_BUF_ERROR. (See, I told you I'd cover this later.)
However this is not a problem at all. Now we finally have the desired
indication that deflate() is really done, and so we drop out of the
inner loop to provide more input to deflate()."

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoFio 3.13 fio-3.13
Jens Axboe [Fri, 8 Feb 2019 19:47:47 +0000 (12:47 -0700)]
Fio 3.13

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agostat: put 'percentiles' object in appropriate 'clat_ns' or 'lat_ns' parent
Vincent Fu [Thu, 7 Feb 2019 15:51:07 +0000 (10:51 -0500)]
stat: put 'percentiles' object in appropriate 'clat_ns' or 'lat_ns' parent

In the JSON output, the 'percentiles' object currently always appears within the
'clat_ns' object. Put it inside the 'lat_ns' object when --lat_percentiles=1 is set.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agostat: clean up calc_clat_percentiles
Vincent Fu [Thu, 7 Feb 2019 15:51:06 +0000 (10:51 -0500)]
stat: clean up calc_clat_percentiles

We already know the size of the buffer needed. So there
is no need to do anything fancy when allocating it.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoImprove wording in REPORTING-BUGS
Jens Axboe [Mon, 4 Feb 2019 16:01:48 +0000 (09:01 -0700)]
Improve wording in REPORTING-BUGS

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: verbose error for -95/-EOPNOTSUPP failure
Jens Axboe [Fri, 1 Feb 2019 05:55:52 +0000 (22:55 -0700)]
t/io_uring: verbose error for -95/-EOPNOTSUPP failure

If we fail with this error and polling is enabled, it's because the
file system hosting the file doesn't support polling. Let the user
know.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoio_uring: ensure we use the right argument syscall
Jens Axboe [Tue, 29 Jan 2019 19:20:02 +0000 (12:20 -0700)]
io_uring: ensure we use the right argument syscall

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: fix bad if
Jens Axboe [Tue, 29 Jan 2019 19:04:22 +0000 (12:04 -0700)]
t/io_uring: fix bad if

We need braces for that check, or it's always going to be true.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoio_uring: update to kernel struct io_uring_params
Jens Axboe [Tue, 29 Jan 2019 13:25:54 +0000 (06:25 -0700)]
io_uring: update to kernel struct io_uring_params

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoio_uring: sync with kernel
Jens Axboe [Mon, 28 Jan 2019 18:42:20 +0000 (11:42 -0700)]
io_uring: sync with kernel

- Update to newer kernel API header
- Use IORING_ENTER_SQ_WAKEUP

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoMerge branch 'hygon-support' of https://github.com/hygonsoc/fio
Jens Axboe [Mon, 28 Jan 2019 17:43:09 +0000 (10:43 -0700)]
Merge branch 'hygon-support' of https://github.com/hygonsoc/fio

* 'hygon-support' of https://github.com/hygonsoc/fio:
  Add Hygon SoC support to enable tsc_reliable feature

5 years agoAdd Hygon SoC support to enable tsc_reliable feature
hygonsoc [Mon, 28 Jan 2019 16:11:04 +0000 (00:11 +0800)]
Add Hygon SoC support to enable tsc_reliable feature

5 years agorate-submit: call ioengine post_init when starting workers
Vincent Fu [Thu, 24 Jan 2019 19:26:42 +0000 (14:26 -0500)]
rate-submit: call ioengine post_init when starting workers

ioengines with post_init steps were not fully fully initialized by
offload worker threads because the post_init function was never called.

Without this patch all libaio operations submitted in offload mode fail
because the ioengine was not fully initialized.

Fixes: 2041bd343da1 ("engines/libaio: add preliminary support for pre-mapped IO buffers")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoio_uring: system calls have been renumbered
Jens Axboe [Wed, 23 Jan 2019 15:04:28 +0000 (08:04 -0700)]
io_uring: system calls have been renumbered

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoengines/io_uring: cleanup setrlimit()
Jens Axboe [Wed, 16 Jan 2019 16:07:13 +0000 (09:07 -0700)]
engines/io_uring: cleanup setrlimit()

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoio_uring: sync with upstream API
Jens Axboe [Wed, 16 Jan 2019 15:45:43 +0000 (08:45 -0700)]
io_uring: sync with upstream API

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoengines/io_uring: ensure sqe stores are ordered SQ ring tail update
Jens Axboe [Wed, 16 Jan 2019 05:06:05 +0000 (22:06 -0700)]
engines/io_uring: ensure sqe stores are ordered SQ ring tail update

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: use fio provided memory barriers
Jens Axboe [Wed, 16 Jan 2019 04:43:52 +0000 (21:43 -0700)]
t/io_uring: use fio provided memory barriers

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agox86-64: correct read/write barriers
Jens Axboe [Wed, 16 Jan 2019 04:43:11 +0000 (21:43 -0700)]
x86-64: correct read/write barriers

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: fixes
Jens Axboe [Tue, 15 Jan 2019 21:48:31 +0000 (14:48 -0700)]
t/io_uring: fixes

- Break out if we get a fatal error from reap_events()
- Ignore polled=1 if do_nop=1

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: terminate buf[] file depth string
Jens Axboe [Tue, 15 Jan 2019 20:52:14 +0000 (13:52 -0700)]
t/io_uring: terminate buf[] file depth string

Prevents garbage print for !s->nr_files (do_nop = 1).

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: wait if we're at queue limit
Jens Axboe [Tue, 15 Jan 2019 17:58:17 +0000 (10:58 -0700)]
t/io_uring: wait if we're at queue limit

There was an off-by-one there, it's perfectly fine not to specify
events to wait for if the submission will take us to the queue
depth limit.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: print file depths
Jens Axboe [Tue, 15 Jan 2019 13:12:54 +0000 (06:12 -0700)]
t/io_uring: print file depths

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: pick next file if we're over the limti
Jens Axboe [Tue, 15 Jan 2019 12:57:54 +0000 (05:57 -0700)]
t/io_uring: pick next file if we're over the limti

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: use the right check for when to wait
Jens Axboe [Mon, 14 Jan 2019 05:49:48 +0000 (22:49 -0700)]
t/io_uring: use the right check for when to wait

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: only call setrlimit() for fixedbufs
Jens Axboe [Sun, 13 Jan 2019 21:22:03 +0000 (14:22 -0700)]
t/io_uring: only call setrlimit() for fixedbufs

It's root only.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoio_uring: add 32-bit x86 support
Jens Axboe [Sun, 13 Jan 2019 17:57:44 +0000 (10:57 -0700)]
io_uring: add 32-bit x86 support

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: add option for register_files
Jens Axboe [Sun, 13 Jan 2019 17:56:39 +0000 (10:56 -0700)]
t/io_uring: add option for register_files

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoio_uring: fix pointer cast warning on 32-bit
Jens Axboe [Sun, 13 Jan 2019 16:17:39 +0000 (09:17 -0700)]
io_uring: fix pointer cast warning on 32-bit

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoio_uring: ensure that the io_uring_register() structs are 32-bit safe
Jens Axboe [Sun, 13 Jan 2019 16:15:32 +0000 (09:15 -0700)]
io_uring: ensure that the io_uring_register() structs are 32-bit safe

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoMove io_uring to os/linux/
Jens Axboe [Sun, 13 Jan 2019 15:56:11 +0000 (08:56 -0700)]
Move io_uring to os/linux/

It's not a generic OS header, reflect the fact that it's Linux only
by moving it to a linux/ directory.

Also update io_uring_sqe to match current API.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: add IORING_OP_NOP support
Jens Axboe [Sun, 13 Jan 2019 05:14:54 +0000 (22:14 -0700)]
t/io_uring: add IORING_OP_NOP support

Doesn't do anything on the kernel side, just a round trip through
the SQ and CQ ring.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: only set IORING_ENTER_GETEVENTS when actively reaping
Jens Axboe [Fri, 11 Jan 2019 21:40:16 +0000 (14:40 -0700)]
t/io_uring: only set IORING_ENTER_GETEVENTS when actively reaping

Don't set it if we don't need to find an event (to_wait == 0).

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoengines/io_uring: remove unused ld->io_us array
Jens Axboe [Fri, 11 Jan 2019 21:15:26 +0000 (14:15 -0700)]
engines/io_uring: remove unused ld->io_us array

Leftover from a previous API

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: remember to set p->sq_thread_cpu
Jens Axboe [Fri, 11 Jan 2019 18:38:29 +0000 (11:38 -0700)]
t/io_uring: remember to set p->sq_thread_cpu

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoio_uring: update to newer API
Jens Axboe [Fri, 11 Jan 2019 17:33:28 +0000 (10:33 -0700)]
io_uring: update to newer API

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: add support for registered files
Jens Axboe [Fri, 11 Jan 2019 05:27:56 +0000 (22:27 -0700)]
t/io_uring: add support for registered files

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: make submits/reaps per-second reflected with sq thread poll
Jens Axboe [Fri, 11 Jan 2019 04:38:35 +0000 (21:38 -0700)]
t/io_uring: make submits/reaps per-second reflected with sq thread poll

If we use polling, the numbers currently read as 0. Make them -1 to
reflect that we're actually doing zero calls per IO.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/io_uring: enable SQ thread poll mode
Jens Axboe [Fri, 11 Jan 2019 04:37:15 +0000 (21:37 -0700)]
t/io_uring: enable SQ thread poll mode

With this, we can do IO without ever entering the kernel.

Signed-off-by: Jens Axboe <axboe@kernel.dk>