ioengines: have ioengines with commit do own io accounting for trims
authorVincent Fu <vincent.fu@wdc.com>
Wed, 25 Jul 2018 19:37:06 +0000 (12:37 -0700)
committerVincent Fu <vincent.fu@wdc.com>
Thu, 26 Jul 2018 15:10:37 +0000 (08:10 -0700)
ioengines.c:td_io_queue has a special case where it calls
io_u_mark_submit() and io_u_mark_complete() when the io_u
is a trim operation or when the ioengine does not have a
commit function. This patch makes these two calls the
responsibility of the ioengine for trim io_u's when the
ioengine does have a commit function.

This only applies to libaio because it is the only ioengine
supporting trims with a commit function. All other ioengines that
support trim operations do not have a commit function. These
ioengines are: falloc, glusterfs_async, mmap, mtd, posixaio,
rados, rbd, splice, sync, psync, pvsync, pvsync2.

engines/libaio.c
ioengines.c

index dae2a70b2c86ea8f8368d97bb680eaccf8d73862..7ac36b236cdf91a33f31ff738176d0fadd8c4235 100644 (file)
@@ -207,6 +207,8 @@ static enum fio_q_status fio_libaio_queue(struct thread_data *td,
                        return FIO_Q_BUSY;
 
                do_io_u_trim(td, io_u);
                        return FIO_Q_BUSY;
 
                do_io_u_trim(td, io_u);
+               io_u_mark_submit(td, 1);
+               io_u_mark_complete(td, 1);
                return FIO_Q_COMPLETED;
        }
 
                return FIO_Q_COMPLETED;
        }
 
index d579682f4a051ce332b509b811e043c55b592c62..efefb0696e6cb14c70190c115fd81c2107d301ff 100644 (file)
@@ -350,7 +350,7 @@ enum fio_q_status td_io_queue(struct thread_data *td, struct io_u *io_u)
                         "invalid block size. Try setting direct=0.\n");
        }
 
                         "invalid block size. Try setting direct=0.\n");
        }
 
-       if (!td->io_ops->commit || io_u->ddir == DDIR_TRIM) {
+       if (!td->io_ops->commit) {
                io_u_mark_submit(td, 1);
                io_u_mark_complete(td, 1);
        }
                io_u_mark_submit(td, 1);
                io_u_mark_complete(td, 1);
        }