Merge branch 'master' of ssh://brick.kernel.dk/data/git/fio
authorJens Axboe <axboe@carl.home.kernel.dk>
Mon, 26 Feb 2007 11:57:32 +0000 (12:57 +0100)
committerJens Axboe <axboe@carl.home.kernel.dk>
Mon, 26 Feb 2007 11:57:32 +0000 (12:57 +0100)
HOWTO
fio.c
fio.h
init.c
ioengines.c

diff --git a/HOWTO b/HOWTO
index 237b3ad23879efea84dbe46c69bd6754dc932f1d..de4b0a9932b43f207260a569a5e33349efebc63b 100644 (file)
--- a/HOWTO
+++ b/HOWTO
@@ -294,6 +294,10 @@ iodepth=int        This defines how many io units to keep in flight against
                job, can be overridden with a larger value for higher
                concurrency.
 
+iodepth_batch=int This defines how many pieces of IO to submit at once.
+               It defaults to the same as iodepth, but can be set lower
+               if one so desires.
+
 iodepth_low=int        The low water mark indicating when to start filling
                the queue again. Defaults to the same as iodepth, meaning
                that fio will attempt to keep the queue full at all times.
diff --git a/fio.c b/fio.c
index b095527e4d028d18ab30d185a7b25c4a93eba7ab..c5b85aeb8c88ca2ef732135fc74ffb8d789325c1 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -433,6 +433,8 @@ requeue:
                         */
                        if (td->io_ops->commit == NULL)
                                io_u_queued(td, io_u);
+                       else if (td->io_u_queued >= td->iodepth_batch)
+                               ret = td_io_commit(td);
                        break;
                case FIO_Q_BUSY:
                        requeue_io_u(td, &io_u);
diff --git a/fio.h b/fio.h
index 57d1b6b995d28dee547e5c9dfeb4858a83e305de..6d0c9e31f36164db8062bfa6d2a2ab74ab1e65ce 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -351,6 +351,7 @@ struct thread_data {
        unsigned int numjobs;
        unsigned int iodepth;
        unsigned int iodepth_low;
+       unsigned int iodepth_batch;
        os_cpu_mask_t cpumask;
        unsigned int iolog;
        unsigned int read_iolog;
@@ -389,6 +390,7 @@ struct thread_data {
        struct list_head io_u_freelist;
        struct list_head io_u_busylist;
        struct list_head io_u_requeues;
+       unsigned int io_u_queued;
 
        /*
         * Rate state
diff --git a/init.c b/init.c
index 8efb24ab58bf17428797e364e045ecb490d6f1eb..636e95766fb3555416da03e9a09335596729bd35 100644 (file)
--- a/init.c
+++ b/init.c
@@ -112,6 +112,12 @@ static struct fio_option options[] = {
                .help   = "Amount of IO buffers to keep in flight",
                .def    = "1",
        },
+       {
+               .name   = "iodepth_batch",
+               .type   = FIO_OPT_INT,
+               .off1   = td_var_offset(iodepth_batch),
+               .help   = "Number of IO to submit in one go",
+       },
        {
                .name   = "iodepth_low",
                .type   = FIO_OPT_INT,
@@ -704,6 +710,12 @@ static void fixup_options(struct thread_data *td)
         */
        if (td->iodepth_low > td->iodepth || !td->iodepth_low)
                td->iodepth_low = td->iodepth;
+
+       /*
+        * If batch number isn't set, default to the same as iodepth
+        */
+       if (td->iodepth_batch > td->iodepth || !td->iodepth_batch)
+               td->iodepth_batch = td->iodepth;
 }
 
 /*
index 727981f12415ab52bace3c2788d589fbc9cc2e99..2cc328883d806497b4f9028919cefe360ef3a377 100644 (file)
@@ -216,6 +216,9 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u)
 
        ret = td->io_ops->queue(td, io_u);
 
+       if (ret == FIO_Q_QUEUED)
+               td->io_u_queued++;
+
        if ((td->io_ops->flags & FIO_SYNCIO) == 0) {
                fio_gettime(&io_u->issue_time, NULL);
 
@@ -242,6 +245,8 @@ int td_io_commit(struct thread_data *td)
 {
        if (!td->cur_depth)
                return 0;
+
+       td->io_u_queued = 0;
        if (td->io_ops->commit)
                return td->io_ops->commit(td);