backend: number of ios not as expected for trimwrite
authorAnkit Kumar <ankit.kumar@samsung.com>
Tue, 13 Sep 2022 10:45:27 +0000 (16:15 +0530)
committerJens Axboe <axboe@kernel.dk>
Tue, 13 Sep 2022 21:03:21 +0000 (15:03 -0600)
number_ios should be twice for trimwrite, just like size or
io_size. Update the documentation for "rw=trimwrite" to explain the
changes.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Reviewed-by: Vincent Fu <vincent.fu@samsung.com>
Link: https://lore.kernel.org/r/20220913104527.18734-2-ankit.kumar@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
HOWTO.rst
backend.c
fio.1

index 2c6c6dbe5cc7bcfd586e0439dd1d526233daaf76..924f5ed956c1dcb2c54840ef0fbd66d30ca72d46 100644 (file)
--- a/HOWTO.rst
+++ b/HOWTO.rst
@@ -1129,7 +1129,11 @@ I/O type
                                Random mixed reads and writes.
                **trimwrite**
                                Sequential trim+write sequences. Blocks will be trimmed first,
-                               then the same blocks will be written to.
+                               then the same blocks will be written to. So if ``io_size=64K``
+                               is specified, Fio will trim a total of 64K bytes and also
+                               write 64K bytes on the same trimmed blocks. This behaviour
+                               will be consistent with ``number_ios`` or other Fio options
+                               limiting the total bytes or number of I/O's.
 
        Fio defaults to read if the option is not specified.  For the mixed I/O
        types, the default is to split them 50/50.  For certain types of I/O the
index fe614f6e1cf025aaf1e24f5b25118d4b1f8ab862..ec535bcc47955bc8bf15b64a76f43686ae5b2368 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -971,9 +971,11 @@ static void do_io(struct thread_data *td, uint64_t *bytes_done)
                total_bytes += td->o.size;
 
        /* In trimwrite mode, each byte is trimmed and then written, so
-        * allow total_bytes to be twice as big */
-       if (td_trimwrite(td))
+        * allow total_bytes or number of ios to be twice as big */
+       if (td_trimwrite(td)) {
                total_bytes += td->total_io_size;
+               td->o.number_ios *= 2;
+       }
 
        while ((td->o.read_iolog_file && !flist_empty(&td->io_log_list)) ||
                (!flist_empty(&td->trim_list)) || !io_issue_bytes_exceeded(td) ||
diff --git a/fio.1 b/fio.1
index 67d7c710fa96393348357f0456999d651483eb23..c67bd46420eb91d08a4ee75cdc0cb535894eb8fa 100644 (file)
--- a/fio.1
+++ b/fio.1
@@ -900,7 +900,10 @@ Random mixed reads and writes.
 .TP
 .B trimwrite
 Sequential trim+write sequences. Blocks will be trimmed first,
-then the same blocks will be written to.
+then the same blocks will be written to. So if `io_size=64K' is specified,
+Fio will trim a total of 64K bytes and also write 64K bytes on the same
+trimmed blocks. This behaviour will be consistent with `number_ios' or
+other Fio options limiting the total bytes or number of I/O's.
 .RE
 .P
 Fio defaults to read if the option is not specified. For the mixed I/O