Merge branch 'io-threads'
authorJens Axboe <axboe@fb.com>
Thu, 23 Apr 2015 17:13:27 +0000 (11:13 -0600)
committerJens Axboe <axboe@fb.com>
Thu, 23 Apr 2015 17:13:27 +0000 (11:13 -0600)
1  2 
options.c
stat.c

diff --combined options.c
index 5fbad317e47a1e9809006e226cf4e29f15c67630,b34e2c72dc3a91e6fe1b15216b0d708d9badb57c..3de1248cce9ef44da252ec41b4578a09b6e39da8
+++ b/options.c
@@@ -443,9 -443,9 +443,9 @@@ static int str_cpumask_cb(void *data, u
  
        for (i = 0; i < sizeof(int) * 8; i++) {
                if ((1 << i) & *val) {
 -                      if (i > max_cpu) {
 +                      if (i >= max_cpu) {
                                log_err("fio: CPU %d too large (max=%ld)\n", i,
 -                                                              max_cpu);
 +                                                              max_cpu - 1);
                                return 1;
                        }
                        dprint(FD_PARSE, "set cpu allowed %d\n", i);
@@@ -503,9 -503,9 +503,9 @@@ static int set_cpus_allowed(struct thre
                                ret = 1;
                                break;
                        }
 -                      if (icpu > max_cpu) {
 +                      if (icpu >= max_cpu) {
                                log_err("fio: CPU %d too large (max=%ld)\n",
 -                                                      icpu, max_cpu);
 +                                                      icpu, max_cpu - 1);
                                ret = 1;
                                break;
                        }
@@@ -1622,6 -1622,26 +1622,26 @@@ struct fio_option fio_options[FIO_MAX_O
                .category = FIO_OPT_C_IO,
                .group  = FIO_OPT_G_IO_BASIC,
        },
+       {
+               .name   = "io_submit_mode",
+               .lname  = "IO submit mode",
+               .type   = FIO_OPT_STR,
+               .off1   = td_var_offset(io_submit_mode),
+               .help   = "How IO submissions and completions are done",
+               .def    = "inline",
+               .category = FIO_OPT_C_IO,
+               .group  = FIO_OPT_G_IO_BASIC,
+               .posval = {
+                         { .ival = "inline",
+                           .oval = IO_MODE_INLINE,
+                           .help = "Submit and complete IO inline",
+                         },
+                         { .ival = "offload",
+                           .oval = IO_MODE_OFFLOAD,
+                           .help = "Offload submit and complete to threads",
+                         },
+               },
+       },
        {
                .name   = "size",
                .lname  = "Size",
diff --combined stat.c
index e42edc91aea4e38be8fd7a1c4fe39f3499801f94,533981fcc89ac20d9297808d8c88ec2b69617202..d143d36c0c60ed1d5d6c1bca6b1aa27bd86c9212
--- 1/stat.c
--- 2/stat.c
+++ b/stat.c
@@@ -1369,7 -1369,7 +1369,7 @@@ void __show_run_stats(void
        struct group_run_stats *runstats, *rs;
        struct thread_data *td;
        struct thread_stat *threadstats, *ts;
 -      int i, j, nr_ts, last_ts, idx;
 +      int i, j, k, nr_ts, last_ts, idx;
        int kb_base_warned = 0;
        int unit_base_warned = 0;
        struct json_object *root = NULL;
                ts->latency_window = td->o.latency_window;
  
                ts->nr_block_infos = td->ts.nr_block_infos;
 -              for (i = 0; i < ts->nr_block_infos; i++)
 -                      ts->block_infos[i] = td->ts.block_infos[i];
 +              for (k = 0; k < ts->nr_block_infos; k++)
 +                      ts->block_infos[k] = td->ts.block_infos[k];
  
                sum_thread_stats(ts, &td->ts, idx);
        }
@@@ -2009,6 -2009,8 +2009,8 @@@ void add_bw_sample(struct thread_data *
        if (spent < td->o.bw_avg_time)
                return;
  
+       td_io_u_lock(td);
        /*
         * Compute both read and write rates for the interval.
         */
        }
  
        fio_gettime(&td->bw_sample_time, NULL);
+       td_io_u_unlock(td);
  }
  
  void add_iops_sample(struct thread_data *td, enum fio_ddir ddir, unsigned int bs,
        if (spent < td->o.iops_avg_time)
                return;
  
+       td_io_u_lock(td);
        /*
         * Compute both read and write rates for the interval.
         */
        }
  
        fio_gettime(&td->iops_sample_time, NULL);
+       td_io_u_unlock(td);
  }
  
  void stat_init(void)