options: flow should parse as FIO_OPT_INT
authorJens Axboe <axboe@kernel.dk>
Mon, 31 Aug 2020 15:07:12 +0000 (09:07 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 31 Aug 2020 15:07:12 +0000 (09:07 -0600)
It's an unsigned int, if we parse it as FIO_OPT_ULL then we clobber
the variable around it in the options struct. This is apparent when
running the examples/flow.fio job file, as flow_sleep=1000 is set
before flow, but gets clobbered when flow is set. This results in a
flow_sleep value of 0 instead of 1000.

Fixes: d4e74fda98b6 ("flow: add ability for weight-based flow control on multiple jobs")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
cconv.c
options.c

diff --git a/cconv.c b/cconv.c
index f37e516191e21cf9bb5f70d8de74c60fc97a43c0..5dc0569f69dc8809f9e15eefd5c0802d3e684f9a 100644 (file)
--- a/cconv.c
+++ b/cconv.c
@@ -281,7 +281,7 @@ void convert_thread_options_to_cpu(struct thread_options *o,
        o->uid = le32_to_cpu(top->uid);
        o->gid = le32_to_cpu(top->gid);
        o->flow_id = __le32_to_cpu(top->flow_id);
-       o->flow = __le32_to_cpu(top->flow);
+       o->flow = le32_to_cpu(top->flow);
        o->flow_sleep = le32_to_cpu(top->flow_sleep);
        o->sync_file_range = le32_to_cpu(top->sync_file_range);
        o->latency_target = le64_to_cpu(top->latency_target);
@@ -480,7 +480,7 @@ void convert_thread_options_to_net(struct thread_options_pack *top,
        top->uid = cpu_to_le32(o->uid);
        top->gid = cpu_to_le32(o->gid);
        top->flow_id = __cpu_to_le32(o->flow_id);
-       top->flow = __cpu_to_le32(o->flow);
+       top->flow = cpu_to_le32(o->flow);
        top->flow_sleep = cpu_to_le32(o->flow_sleep);
        top->sync_file_range = cpu_to_le32(o->sync_file_range);
        top->latency_target = __cpu_to_le64(o->latency_target);
index 067597ecde48807c39dd03b2aceeeaa654467953..0d64e7c0581e9ad912d85315fcc85cab1cd06506 100644 (file)
--- a/options.c
+++ b/options.c
@@ -4696,7 +4696,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
        {
                .name   = "flow",
                .lname  = "I/O flow weight",
-               .type   = FIO_OPT_ULL,
+               .type   = FIO_OPT_INT,
                .off1   = offsetof(struct thread_options, flow),
                .help   = "Weight for flow control of this job",
                .parent = "flow_id",