fio.git
9 years agoBump disk util stats from 32 to 64-bit values
Jens Axboe [Mon, 1 Dec 2014 16:42:48 +0000 (09:42 -0700)]
Bump disk util stats from 32 to 64-bit values

Robert reports:

A long run can result in wrapping in the disk stats
(ios, merge, ticks, in_queue).

In this example, there were 212,245,615,134 read IOs
(that is from uint64_t total_io_u[3]):
  read : io=101207GB, bw=491309KB/s, iops=982618, runt=216000016msec
  cpu          : usr=0.09%, sys=4.33%, ctx=152784302066, majf=0, minf=2928
  IO depths    : 1=0.0%, 2=0.0%, 4=0.0%, 8=0.5%, 16=0.5%, 32=1.0%, >=64=1.0%
     submit    : 0=0.0%, 4=18.0%, 8=6.6%, 16=8.5%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=0.0%, 8=0.0%, 16=15.0%, 32=0.1%, 64=0.1%, >=64=0.1%
     issued    : total=r=212245615134/w=0/d=0, short=r=0/w=0/d=0, drop=r=0/w=0/d=0
     latency   : target=0, window=0, percentile=100.00%, depth=96

Run status group 0 (all jobs):
   READ: io=101207GB, aggrb=491309KB/s, minb=491309KB/s, maxb=491309KB/s, mint=216000016msec, maxt=216000016msec

All the disk stats, however, wrap at ios=4,294,967,295 (32 bit).
In this case it caught sdi falling a bit behind the others,
but all of them have wrapped multiple times.

Disk stats (read/write):
  sdb: ios=796157304/0, merge=0/0, ticks=722039638/0, in_queue=735284999, util=100.00%
  sdc: ios=725235994/0, merge=0/0, ticks=725893305/0, in_queue=738790349, util=100.00%
  sdd: ios=722370867/0, merge=0/0, ticks=724540972/0, in_queue=738926102, util=100.00%
  sde: ios=722490025/0, merge=0/0, ticks=724775894/0, in_queue=745581851, util=100.00%
  sdf: ios=719665329/0, merge=0/0, ticks=724281840/0, in_queue=740201203, util=100.00%
  sdg: ios=721386377/0, merge=0/0, ticks=725529483/0, in_queue=740729310, util=100.00%
  sdh: ios=720461888/0, merge=0/0, ticks=724759222/0, in_queue=741212131, util=100.00%
  sdi: ios=3280272329/0, merge=0/0, ticks=3337080572/0, in_queue=3340290775, util=81.57%
  sdj: ios=717395167/0, merge=0/0, ticks=723762993/0, in_queue=739136654, util=100.00%
  sdk: ios=824804416/0, merge=0/0, ticks=722973383/0, in_queue=734915061, util=100.00%
  sdl: ios=787317365/0, merge=0/0, ticks=720963594/0, in_queue=736506238, util=100.00%
  sdm: ios=791112845/0, merge=0/0, ticks=723371287/0, in_queue=745590636, util=100.00%
  sdn: ios=786009870/0, merge=0/0, ticks=721111447/0, in_queue=733786474, util=100.00%
  sdo: ios=787226466/0, merge=0/0, ticks=722200707/0, in_queue=737673635, util=100.00%
  sdp: ios=789062478/0, merge=0/0, ticks=723648481/0, in_queue=737820918, util=100.00%
  sdq: ios=786121713/0, merge=0/0, ticks=722203635/0, in_queue=752578258, util=100.00%

These structures are the reason:
struct disk_util_stats {
        uint32_t ios[2];
        uint32_t merges[2];
        uint64_t sectors[2];
        uint32_t ticks[2];
        uint32_t io_ticks;
        uint32_t time_in_queue;
        uint64_t msec;
};
struct disk_util_agg {
        uint32_t ios[2];
        uint32_t merges[2];
        uint64_t sectors[2];
        uint32_t ticks[2];
        uint32_t io_ticks;
        uint32_t time_in_queue;
        uint32_t slavecount;
        fio_fp64_t max_util;
};

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoMake gfio build with --build-static
Jens Axboe [Tue, 25 Nov 2014 23:02:52 +0000 (16:02 -0700)]
Make gfio build with --build-static

We can't build the gtk app statically, so filter out the static part
for just that. Fix up the Makefile so that fio doesn't include
all the gtk libs as well.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoFixup t/ test apps for lfsr_next change()
Jens Axboe [Mon, 24 Nov 2014 15:07:03 +0000 (08:07 -0700)]
Fixup t/ test apps for lfsr_next change()

Reported-by: Bruce Cran <bruce@cran.org.uk>
Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agolfsr: don't pass in last value to lfsr_next()
Jens Axboe [Mon, 24 Nov 2014 01:41:11 +0000 (18:41 -0700)]
lfsr: don't pass in last value to lfsr_next()

It's cached in the 'fl' struct. This means we can move the max
block calculation outside if the lfsr part, too.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoiolog: account for wasted time in ipo stall
Jens Axboe [Fri, 21 Nov 2014 21:33:33 +0000 (14:33 -0700)]
iolog: account for wasted time in ipo stall

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoblktrace: correct setting of iodepth
Jens Axboe [Fri, 21 Nov 2014 20:49:00 +0000 (13:49 -0700)]
blktrace: correct setting of iodepth

We want to check for == 1, not != 1. Also set iodepth_low, like
we would have done for a "normal" job file.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoserver: fix missing ETA in some cases
Jens Axboe [Wed, 19 Nov 2014 16:34:01 +0000 (09:34 -0700)]
server: fix missing ETA in some cases

If we get an ETA request from the client, we pass in 'force' to
ignore any time constraints. But we fail to pass the force through,
so we can fail sending the requested ETA and the client just looks
like nothing is running even though it is.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agotrigger: always send trigger, not just when remote command is set
Jens Axboe [Wed, 19 Nov 2014 16:21:16 +0000 (09:21 -0700)]
trigger: always send trigger, not just when remote command is set

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoclient: defer local trigger execute until after state is received
Jens Axboe [Wed, 19 Nov 2014 16:09:01 +0000 (09:09 -0700)]
client: defer local trigger execute until after state is received

Don't run it immediately, we have to wait until we receive the
data from the server.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoHOWTO: add description and examples of verify triggers
Jens Axboe [Wed, 19 Nov 2014 16:06:42 +0000 (09:06 -0700)]
HOWTO: add description and examples of verify triggers

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agotrigger: enable separate remote and local trigger
Jens Axboe [Wed, 19 Nov 2014 15:36:12 +0000 (08:36 -0700)]
trigger: enable separate remote and local trigger

Change the options so that we have the trigger file and command
separate, and remote and local trigger command separate as well.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoKill off -Wshadow again
Jens Axboe [Wed, 19 Nov 2014 03:14:23 +0000 (20:14 -0700)]
Kill off -Wshadow again

Too many warnings, even for system headers.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoverify: allow empty/no trigger file
Jens Axboe [Wed, 19 Nov 2014 02:16:06 +0000 (19:16 -0700)]
verify: allow empty/no trigger file

If we use a trigger timeout, we don't need the file.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoFix some shadow warnings for some gcc variants
Jens Axboe [Wed, 12 Nov 2014 18:11:20 +0000 (11:11 -0700)]
Fix some shadow warnings for some gcc variants

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoverify: verify_state_gen_name() should check size
Jens Axboe [Wed, 12 Nov 2014 03:51:37 +0000 (20:51 -0700)]
verify: verify_state_gen_name() should check size

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoMerge branch 'verify-trigger'
Jens Axboe [Tue, 11 Nov 2014 18:10:35 +0000 (11:10 -0700)]
Merge branch 'verify-trigger'

9 years agoFio 2.1.14 fio-2.1.14
Jens Axboe [Tue, 11 Nov 2014 18:09:59 +0000 (11:09 -0700)]
Fio 2.1.14

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoclient: replace duplicate code with read_data()
Jens Axboe [Tue, 11 Nov 2014 17:24:00 +0000 (10:24 -0700)]
client: replace duplicate code with read_data()

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoAdd support for verify triggers and verify state saving
Jens Axboe [Tue, 11 Nov 2014 03:34:00 +0000 (20:34 -0700)]
Add support for verify triggers and verify state saving

This allows you to (for instance) instantly terminate a verify
write workload, and then later that everything was written
correctly up to that very point. This can be useful for testing
powercut scenarios, which is often problematic on storage
devices.

The trigger part is a file based notification scheme, similar
to what is provided for the status dumps. When triggered,
fio will exit immediately and write the verify state safely
to disk. A trigger can be accompanied by a trigger command.
Say you wanted to test powercut safety, the trigger could be
something that immediately cut power to the machine.

The verify state is either saved locally (if run locally),
or saved over the network if run in client/server mode.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agot/btrace2fio: don't dec inflight for requeue
Jens Axboe [Tue, 11 Nov 2014 16:39:11 +0000 (09:39 -0700)]
t/btrace2fio: don't dec inflight for requeue

We don't inc it again on issue, so we'll end up with an assert
trigger on inflight going negative.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agot/btrace2fio: fix divide-by-zero in rate calculation
Jens Axboe [Tue, 11 Nov 2014 15:09:04 +0000 (08:09 -0700)]
t/btrace2fio: fix divide-by-zero in rate calculation

If usec is less than 1000, it'd crash.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoMakefile: add -Wshadow
Jens Axboe [Tue, 11 Nov 2014 15:07:09 +0000 (08:07 -0700)]
Makefile: add -Wshadow

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoFixup some of the time (usec) based conversions
Stephen M. Cameron [Tue, 11 Nov 2014 03:31:26 +0000 (20:31 -0700)]
Fixup some of the time (usec) based conversions

Modified by Jens to fixup some of the mtime/utime confusion,
and add a specific ->is_time to options to get rid of future
issues in this area.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoGet rid if ddir_trim() macro
Jens Axboe [Mon, 10 Nov 2014 22:40:24 +0000 (15:40 -0700)]
Get rid if ddir_trim() macro

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoFix crash on threads being reaped before they are created
Jens Axboe [Mon, 10 Nov 2014 21:08:50 +0000 (14:08 -0700)]
Fix crash on threads being reaped before they are created

If we do that, then ->rusage_sem is never allocated.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoAdd option for statically build fio
Jens Axboe [Mon, 10 Nov 2014 18:18:06 +0000 (11:18 -0700)]
Add option for statically build fio

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agot/btrace2fio: cap depth if we don't see completion traces
Jens Axboe [Mon, 10 Nov 2014 15:52:23 +0000 (08:52 -0700)]
t/btrace2fio: cap depth if we don't see completion traces

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoFix for a race when fio prints I/O statistics periodically
Vasily Tarasov [Mon, 10 Nov 2014 03:22:24 +0000 (20:22 -0700)]
Fix for a race when fio prints I/O statistics periodically

Below is the demonstration for the latest code in git:

Job-file:

[job]
filename=/dev/sda
rw=randread
blocksize=4096
direct=1
time_based=1
runtime=300
numjobs=16

Command line:

fio --output-format=json --status-interval=10  /tmp/job.file | tee /tmp/fio.out

After parsing json and printing per-job "read->runtime" and "read->iops" in two
columns, one can see this:

runtime iops
9854 4762
19861 4724
29867 4711
39873 4705
49880 4701
59886 4698
69894 4696
79900 4694
89907 4693
99913 4692
109919 4692
119926 4691
129933 4691
139940 4691
149946 4691
159953 4690
169959 4690
179966 4690
189972 4690
199978 4690
209984 4690
219990 4690
229996 4690
240002 4690
250009 4690
260015 4690
270021 4690
280027 4690
290033 4690
600043 2344 <--- You can see a spurious jump in runtime here
300001 4690

The problem is two-fold, IMHO:

1) td->ts.runtime[DDIR_READ/DDIR_WRITE/DDIR_TRIM] are set in microseconds
   instead of milliseconds in thread_main() function. The values are later
   converted to milliseconds (after exiting from the loop in thread_main()),
   but it is too late for the out-of-band access by the helper_thread
   (the one that prints periodic statistics).

2) The helper_thread in __show_running_run_stats() temporarily adds to
   td->ts.runtime[DDIR_READ/DDIR_WRITE/DDIR_TRIM]
   the time that has passed since the beginning of the loop (td->start).
   However, the same addition happens in thread_main() by the job
   thread and td->start is not reset atomically with this addition.
   As a result, the runtime can be added twice. (That's why in the output
   we see 600043, which is approximately twice larger than the
   previous reading).

My proposal is to make the job threads updating both td->ts.runtime and
td->start atomically by using an already existing stat_mutex.
__show_running_run_stats() already takes this mutex where needed.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoclient/server: percentile_precision wasn't net converted
Jens Axboe [Sat, 8 Nov 2014 01:47:41 +0000 (18:47 -0700)]
client/server: percentile_precision wasn't net converted

We'd get 0 precision on the percentile dumps, which was confusing
and lost info.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoiolog: fix intermittent crash on exit with verify enabled
Jens Axboe [Fri, 7 Nov 2014 22:41:24 +0000 (15:41 -0700)]
iolog: fix intermittent crash on exit with verify enabled

Commit 9342d5f807795 added flist_first_entry(), but the
conversion io iolog hist list pruning was wrong. Fix it.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoAdd time_since_genesis()
Jens Axboe [Fri, 7 Nov 2014 17:36:33 +0000 (10:36 -0700)]
Add time_since_genesis()

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agosmalloc: add zeroing scalloc() variant
Jens Axboe [Thu, 6 Nov 2014 22:19:31 +0000 (15:19 -0700)]
smalloc: add zeroing scalloc() variant

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoMake fio -Wshadow clean
Jens Axboe [Thu, 6 Nov 2014 16:21:10 +0000 (09:21 -0700)]
Make fio -Wshadow clean

Found a few issues, actually.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoGet rid of __ prefix for internal frand state
Jens Axboe [Thu, 6 Nov 2014 01:39:23 +0000 (18:39 -0700)]
Get rid of __ prefix for internal frand state

It made (some) sense when we had both OS and frand in anon unions,
but now lets just kill it.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoRemove use of OS provided random functions
Jens Axboe [Thu, 6 Nov 2014 01:34:02 +0000 (18:34 -0700)]
Remove use of OS provided random functions

We added the internal random generator a long time ago, and kept
the OS variant around as an opt-in feature with using use_os_rand=1.
We defaulted to using the fio provided one, and I doubt that
anyone has used the option.

The time has come to kill it.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoAdd basic DragonFly support
Jens Axboe [Wed, 5 Nov 2014 02:53:04 +0000 (19:53 -0700)]
Add basic DragonFly support

Saw the build failing in their logs, and it hurt my feelings.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoMerge branch 'master' of ssh://git.kernel.dk/data/git/fio
Jens Axboe [Thu, 30 Oct 2014 23:16:32 +0000 (17:16 -0600)]
Merge branch 'master' of ssh://git.kernel.dk/data/git/fio

9 years agoMerge branch 'master' of ssh://git.kernel.dk/data/git/fio
Jens Axboe [Thu, 30 Oct 2014 16:13:33 +0000 (10:13 -0600)]
Merge branch 'master' of ssh://git.kernel.dk/data/git/fio

9 years agoconfigure: disable lex/yacc on Solaris
Jens Axboe [Thu, 30 Oct 2014 16:11:32 +0000 (10:11 -0600)]
configure: disable lex/yacc on Solaris

It currently breaks, disable it until we can figure it out:

   LEX lex.yy.c
"exp/expression-parser.l":line 166: Warning: Non-portable Character Class
  YACC y.tab.c
    CC lex.yy.o
exp/expression-parser.l:43:37: error: conflicting types for ‘yyunput’
lex.yy.c:31:7: note: previous declaration of ‘yyunput’ was here
exp/expression-parser.l:44:46: error: macro "input" passed 1 arguments, but takes just 0
exp/expression-parser.l: In function ‘yylex’:
exp/expression-parser.l:61:1: warning: label ‘yyfussy’ defined but not used
exp/expression-parser.l:54:22: warning: unused variable ‘yyprevious’
exp/expression-parser.l: At top level:
exp/expression-parser.l:297:1: warning: missing braces around initializer
exp/expression-parser.l:297:1: warning: (near initialization for ‘yycrank[0]’)
exp/expression-parser.l:376:1: warning: missing braces around initializer
exp/expression-parser.l:376:1: warning: (near initialization for ‘yysvec[0]’)
exp/expression-parser.l:714:6: error: conflicting types for ‘yyunput’
exp/expression-parser.l:43:37: note: previous declaration of ‘yyunput’ was here
make: *** [lex.yy.o] Error 1

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agommap: set 'fd' to -1
Jens Axboe [Thu, 30 Oct 2014 14:40:47 +0000 (08:40 -0600)]
mmap: set 'fd' to -1

This looks like a typo, using '1' makes no sense. This fixes Solaris
anon allocs.

Reported-by: Sébastien Bouchex Bellomié <sbouchex@infovista.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoengines: rename option specific pad from 'td' to 'pad'
Jens Axboe [Wed, 29 Oct 2014 14:30:07 +0000 (08:30 -0600)]
engines: rename option specific pad from 'td' to 'pad'

Except the net engine, they all just use it as padding to avoid
having a zero offset member. The latter makes the parser think
the offset isn't set, so not valid.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoengines/rbd: sort IO by start time before waiting on it
Jens Axboe [Wed, 29 Oct 2014 14:26:28 +0000 (08:26 -0600)]
engines/rbd: sort IO by start time before waiting on it

Instead of waiting on the first random IO we find, wait on the
oldest one. For higher queue depth, this should yield better
performance and lower latencies.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoMerge branch 'optimize-busy-poll' of https://github.com/ketor/fio
Jens Axboe [Wed, 29 Oct 2014 14:23:46 +0000 (08:23 -0600)]
Merge branch 'optimize-busy-poll' of https://github.com/ketor/fio

Ketor writes:

Origin code use rbd_aio_is_complete to check if the io is complete.But
this function use mutex lock and unlock to get the complete result, this
will cause the thread context switch and lock wait latency. And also
because the lock and context switch latency is in the getevents thread,
will decrease the getevents speed and increase the test latency.

This patch go back to use an varible io_complete to check if the io is
complete. This variable is updated in the aiocb callback function and
will not influence the getevents speed.

In our practice, we run fio test jobs=1 iodepth=1 bs=4k busy_poll=1.
Before this patch: IOPS is 30930 After this patch: IOPS is 37300.  And
also after this patch we get avg 25us latency, is nearly equal to the
systemtap test result of the librbd randwrite process.

So I think this patch is realy needed.

9 years agouse io_complete var to avoid the rbd_aio_is_complete lock and context switch
Ketor Meng [Wed, 29 Oct 2014 15:57:02 +0000 (15:57 +0000)]
use io_complete var to avoid the rbd_aio_is_complete lock and context switch

Signed-off-by: Ketor Meng <d.ketor@gmail.com>
9 years agofix rbd_option parse error
Ketor Meng [Wed, 29 Oct 2014 15:09:57 +0000 (15:09 +0000)]
fix rbd_option parse error

Signed-off-by: Ketor Meng <d.ketor@gmail.com>
9 years agoMerge branch 'fix-rbd-options-parse' of https://github.com/ketor/fio
Jens Axboe [Wed, 29 Oct 2014 14:22:45 +0000 (08:22 -0600)]
Merge branch 'fix-rbd-options-parse' of https://github.com/ketor/fio

Ketor writes:

There is two bug in the rbd_options parse:
1. The memeber struct thread_data *td of struct rbd_options is filled in
the cmdline parse process.So it is usable and cannot be deleted.

2.The busy_poll offset of struct rbd_options is not the "busy_poll" but
"client_name"

After fix these two bugs, the fio test then can run.

9 years agoengines/glusterfs_async: remove no-op prep function
Jens Axboe [Wed, 29 Oct 2014 02:49:56 +0000 (20:49 -0600)]
engines/glusterfs_async: remove no-op prep function

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoengines/glusterfs_async: cleanups
Jens Axboe [Wed, 29 Oct 2014 02:48:33 +0000 (20:48 -0600)]
engines/glusterfs_async: cleanups

- Style issues
- Unnecessary casts
- Unnecessary variables inits

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoengines/glfs_async: add trim support
Jens Axboe [Wed, 29 Oct 2014 02:40:21 +0000 (20:40 -0600)]
engines/glfs_async: add trim support

If available.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoengines/rbd: add option to busy poll on event completion
Jens Axboe [Tue, 28 Oct 2014 16:02:22 +0000 (10:02 -0600)]
engines/rbd: add option to busy poll on event completion

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoengines/rbd: remove unused rbd_options->td
Jens Axboe [Tue, 28 Oct 2014 15:19:55 +0000 (09:19 -0600)]
engines/rbd: remove unused rbd_options->td

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoengines/rbd: use rbd_aio_is_complete() and add TRIM support
Jens Axboe [Tue, 28 Oct 2014 15:03:11 +0000 (09:03 -0600)]
engines/rbd: use rbd_aio_is_complete() and add TRIM support

Using fri->io_complete is potentially racy, since we have no
locking around checking and waiting. Use the API provided
function to check for completion instead.

Add support for TRIM through rbd_aio_discard().

Cleanup the queue interface and completion creation.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoengines/rbd: add support for rbd_invalidate_cache()
Jens Axboe [Tue, 28 Oct 2014 15:00:06 +0000 (09:00 -0600)]
engines/rbd: add support for rbd_invalidate_cache()

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agorbd: various fixes and cleanups
Jens Axboe [Mon, 27 Oct 2014 16:53:52 +0000 (10:53 -0600)]
rbd: various fixes and cleanups

- Don't use usleep() when no completions are available, call into
  rbd to wait for one.

- Check for errors on reads/writes/syncs instead of just assuming
  that everything went fine.

- Fix leak of completions when read/write/sync fails.

- Style cleanups, and remove unnecessary casts.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agofio: Fix padding properly
Gwendal Grignou [Sat, 25 Oct 2014 23:04:32 +0000 (16:04 -0700)]
fio: Fix padding properly

Completely fix padding:
- use anonymous union for padding.
- move existing padding in thread_stat.
- add alignment checks.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoLoop Iteration Offset Bug
Brian Fulton [Fri, 24 Oct 2014 20:47:34 +0000 (14:47 -0600)]
Loop Iteration Offset Bug

Reset file descriptor offset value to the initial value when file is
closed and io state is cleared. This fixes the bug where previous offset
values persist between loop iterations.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoFix fp alignment
Jens Axboe [Fri, 24 Oct 2014 20:47:02 +0000 (14:47 -0600)]
Fix fp alignment

Commit a5bbbd8a324a fixed alignment earlier up, but then screwed
it up further down. Fix it.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agofio: fix alignement to prevent bus error on ARM
Gwendal Grignou [Fri, 24 Oct 2014 20:42:37 +0000 (13:42 -0700)]
fio: fix alignement to prevent bus error on ARM

Add a filler field to be ensure 64bit alignment.
Otherwise, we would trigger SIGBUS error in sum_stat()

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agodiskutil: get rid of disk_util_start_exit()
Jens Axboe [Fri, 24 Oct 2014 05:47:01 +0000 (23:47 -0600)]
diskutil: get rid of disk_util_start_exit()

No need to wrap this in a function, just set the exit variable.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoConsolidate disk util, eta, and status check thread
Jens Axboe [Fri, 24 Oct 2014 05:16:50 +0000 (23:16 -0600)]
Consolidate disk util, eta, and status check thread

We don't need two, we can just have one do everything.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agostat: avoid hang with race in stat thread exit and rusage update
Jens Axboe [Fri, 24 Oct 2014 05:04:37 +0000 (23:04 -0600)]
stat: avoid hang with race in stat thread exit and rusage update

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoStart and stop status interval (or file) thread separately
Jens Axboe [Thu, 23 Oct 2014 15:15:20 +0000 (09:15 -0600)]
Start and stop status interval (or file) thread separately

This gets rid of the need to create threads on the fly for this,
and we can manage it and stop it before we do real stats at
the end.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agobackend: remove debug du thread exit notice
Jens Axboe [Thu, 23 Oct 2014 14:58:16 +0000 (08:58 -0600)]
backend: remove debug du thread exit notice

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoGet rid of (now unused) disk_util_mutex
Jens Axboe [Thu, 23 Oct 2014 14:55:52 +0000 (08:55 -0600)]
Get rid of (now unused) disk_util_mutex

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoFix exit being slowed by disk util stat time
Jens Axboe [Thu, 23 Oct 2014 14:53:33 +0000 (08:53 -0600)]
Fix exit being slowed by disk util stat time

Add a cv/lock to handle exit of the disk util thread. This is a
lot cleaner than the adhoc method that was used before, and it
means that we can signal the exit immediately instead of waiting
for DISKUTIL_MSEC to pass.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agot/dedupe: fix init of all thread variables
Jens Axboe [Tue, 21 Oct 2014 19:02:29 +0000 (13:02 -0600)]
t/dedupe: fix init of all thread variables

->dupes wasn't initialized, for instance. Just memset the
whole thing, so we don't run into this again.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agocompiler: improve gcc 4.x compile time check
Jens Axboe [Tue, 21 Oct 2014 14:07:33 +0000 (08:07 -0600)]
compiler: improve gcc 4.x compile time check

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoFix typo in alignment check
Shu-Yu Fu [Tue, 21 Oct 2014 13:57:55 +0000 (07:57 -0600)]
Fix typo in alignment check

It checks percentile_list twice and forgets latency_percentile
in the thread_options_pack structure. Add alignment after the
32-bit sync_file_range to make it align properly.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoAdd alignment to thread_options_pack for proper fp alignment
Jens Axboe [Mon, 20 Oct 2014 16:56:46 +0000 (10:56 -0600)]
Add alignment to thread_options_pack for proper fp alignment

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agofio: add alignment check for fp fields
Jens Axboe [Mon, 20 Oct 2014 16:52:31 +0000 (10:52 -0600)]
fio: add alignment check for fp fields

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agostat: ensure that the fp fields are 64-bit aligned
Jens Axboe [Mon, 20 Oct 2014 16:52:21 +0000 (10:52 -0600)]
stat: ensure that the fp fields are 64-bit aligned

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoAdd some build assert macros
Jens Axboe [Mon, 20 Oct 2014 16:51:24 +0000 (10:51 -0600)]
Add some build assert macros

Stolen from the linux kernel.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoBSD Yacc doesn't understand --no-lines, so use -l instead
Bruce Cran [Wed, 15 Oct 2014 20:16:35 +0000 (14:16 -0600)]
BSD Yacc doesn't understand --no-lines, so use -l instead

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoengines/net: get rid of conversion warning on clang/OSX
Jens Axboe [Wed, 15 Oct 2014 14:51:43 +0000 (08:51 -0600)]
engines/net: get rid of conversion warning on clang/OSX

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoGet rid if --header-file argument for lex
Jens Axboe [Wed, 15 Oct 2014 03:12:22 +0000 (21:12 -0600)]
Get rid if --header-file argument for lex

Since we now wrap the lexer_input() call, should be safe to just
get rid of the lexer.h define since we don't need size_t/yy_size_t.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoclient: fix potential NULL dereference
Jens Axboe [Wed, 15 Oct 2014 01:56:25 +0000 (19:56 -0600)]
client: fix potential NULL dereference

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agot/btrace2fio: fix fd leak on error
Jens Axboe [Wed, 15 Oct 2014 01:55:18 +0000 (19:55 -0600)]
t/btrace2fio: fix fd leak on error

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agot/dedupe: fix bogus items NULL compare
Jens Axboe [Wed, 15 Oct 2014 01:54:21 +0000 (19:54 -0600)]
t/dedupe: fix bogus items NULL compare

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agosha256: cast shift to uint64_t
Jens Axboe [Wed, 15 Oct 2014 01:50:31 +0000 (19:50 -0600)]
sha256: cast shift to uint64_t

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agocrc/test: fix potential div by zero
Jens Axboe [Wed, 15 Oct 2014 01:47:41 +0000 (19:47 -0600)]
crc/test: fix potential div by zero

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoengines/libaio: fix wrong setting of wait_start
Jens Axboe [Tue, 14 Oct 2014 18:17:00 +0000 (12:17 -0600)]
engines/libaio: fix wrong setting of wait_start

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoserver/client: don't use __ conversion functions if not needed
Jens Axboe [Mon, 13 Oct 2014 22:05:10 +0000 (16:05 -0600)]
server/client: don't use __ conversion functions if not needed

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoengines: don't use printf or stderr directly
Jens Axboe [Mon, 13 Oct 2014 18:18:07 +0000 (12:18 -0600)]
engines: don't use printf or stderr directly

For networked runs, we can't just print to stdout or stderr.
Use the appropriate logging functions.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agobackend: use log_info_flush(), not fflush()
Jens Axboe [Mon, 13 Oct 2014 17:57:15 +0000 (11:57 -0600)]
backend: use log_info_flush(), not fflush()

f_out may not be stdout, so use the appropriate wrapper
that flushes the appropriate FILE (or nothing, if nothing
needs to be done).

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agosmalloc: use log_err() for errors
Jens Axboe [Mon, 13 Oct 2014 17:53:55 +0000 (11:53 -0600)]
smalloc: use log_err() for errors

If this happens at runtime, stderr/stdout may have been closed
and used for server/client connections.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoclient: partial revert of 9899aff3e345
Jens Axboe [Mon, 13 Oct 2014 17:33:27 +0000 (11:33 -0600)]
client: partial revert of 9899aff3e345

We do need the client->nr_stat, otherwise things break when
group reporting is not used. We need it to keep track of
how many thread_stat's we are expecting to receive from
each client.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoclient: get rid of (now) unused client->nr_stat
Jens Axboe [Mon, 13 Oct 2014 16:15:47 +0000 (10:15 -0600)]
client: get rid of (now) unused client->nr_stat

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoclient: always output summed output for all clients
Jens Axboe [Mon, 13 Oct 2014 16:09:28 +0000 (10:09 -0600)]
client: always output summed output for all clients

At least if we have more than 1 client.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agostat: set kb/unit_base, if not already set
Jens Axboe [Mon, 13 Oct 2014 16:07:45 +0000 (10:07 -0600)]
stat: set kb/unit_base, if not already set

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoSet genesis time when running only network clients
Jens Axboe [Sun, 12 Oct 2014 19:11:35 +0000 (13:11 -0600)]
Set genesis time when running only network clients

Otherwise we get potentially no or erratic ETA reporting,
depending on the system.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoMakefile: don't install test binaries
Jens Axboe [Sat, 11 Oct 2014 16:19:42 +0000 (10:19 -0600)]
Makefile: don't install test binaries

Split the t/ binaries into internal test, and external test
tools. Prefix the external test tools with fio-, so that we
know where they are from when they are installed.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoengines/libaio: better protect against a busy loop in getevents()
Andrey Kuzmin [Fri, 10 Oct 2014 02:14:27 +0000 (20:14 -0600)]
engines/libaio: better protect against a busy loop in getevents()

If we reap nothing and we were asked to reap > 0 events, then
reuse our commit, sleep, and retry loop.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agostat: add total/short/drop ios to the json output
Jens Axboe [Fri, 10 Oct 2014 02:05:55 +0000 (20:05 -0600)]
stat: add total/short/drop ios to the json output

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoUpdate documentation on net engine port usage
Jens Axboe [Fri, 10 Oct 2014 01:58:24 +0000 (19:58 -0600)]
Update documentation on net engine port usage

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoengines/net: add subjob number to given port
Jens Axboe [Fri, 10 Oct 2014 01:55:21 +0000 (19:55 -0600)]
engines/net: add subjob number to given port

If we use numjobs=x where x > 1, then we don't want to reuse the
same port. Bump it within a group, using the subjob number.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoconfigure: only print gtk status if --enable-gfio used
Jens Axboe [Fri, 10 Oct 2014 00:15:36 +0000 (18:15 -0600)]
configure: only print gtk status if --enable-gfio used

Otherwise we always just print no, even though we did not check.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoengines/net: use link close message on TCP as well
Jens Axboe [Fri, 10 Oct 2014 00:10:11 +0000 (18:10 -0600)]
engines/net: use link close message on TCP as well

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoeta: don't count TD_SETTING_UP as a running process
Jens Axboe [Fri, 10 Oct 2014 00:06:15 +0000 (18:06 -0600)]
eta: don't count TD_SETTING_UP as a running process

We don't want to spam the console with waiting lines.

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agoengines/net: turn off UDP package dropping if buf size doesn't match
Jens Axboe [Thu, 9 Oct 2014 19:38:06 +0000 (13:38 -0600)]
engines/net: turn off UDP package dropping if buf size doesn't match

Signed-off-by: Jens Axboe <axboe@fb.com>
9 years agostat: add dropped ios to the standard output
Jens Axboe [Thu, 9 Oct 2014 19:27:44 +0000 (13:27 -0600)]
stat: add dropped ios to the standard output

Signed-off-by: Jens Axboe <axboe@fb.com>