Add randtrimwrite data direction
authorJens Axboe <axboe@kernel.dk>
Wed, 28 Sep 2022 15:11:41 +0000 (09:11 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 28 Sep 2022 16:06:40 +0000 (10:06 -0600)
This works like trimwrite, except we use random offsets for the trim
location rather than sequential ones.

Suggested-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
HOWTO.rst
fio.1
io_ddir.h
options.c

index 924f5ed956c1dcb2c54840ef0fbd66d30ca72d46..e89d05f04791d22d9369aa9466b48d5e86dfc1ab 100644 (file)
--- a/HOWTO.rst
+++ b/HOWTO.rst
@@ -1134,6 +1134,9 @@ I/O type
                                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.
+               **randtrimwrite**
+                               Like trimwrite, but uses random offsets rather
+                               than sequential writes.
 
        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
diff --git a/fio.1 b/fio.1
index 39d6b4f4902395fc547abcf33872ff3db6f78c84..4324a9750954624e040056d90502a31d93ebfa11 100644 (file)
--- a/fio.1
+++ b/fio.1
@@ -904,6 +904,11 @@ 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.
+.TP
+.B randtrimwrite
+Like
+.B trimwrite ,
+but uses random offsets rather than sequential writes.
 .RE
 .P
 Fio defaults to read if the option is not specified. For the mixed I/O
index 296a9d04ac53cc1c44585ee736f8ea424375615d..7227e9ee7f026f353ec0945cc22632a437bca5f0 100644 (file)
--- a/io_ddir.h
+++ b/io_ddir.h
@@ -41,6 +41,7 @@ enum td_ddir {
        TD_DDIR_RANDRW          = TD_DDIR_RW | TD_DDIR_RAND,
        TD_DDIR_RANDTRIM        = TD_DDIR_TRIM | TD_DDIR_RAND,
        TD_DDIR_TRIMWRITE       = TD_DDIR_TRIM | TD_DDIR_WRITE,
+       TD_DDIR_RANDTRIMWRITE   = TD_DDIR_RANDTRIM | TD_DDIR_WRITE,
 };
 
 #define td_read(td)            ((td)->o.td_ddir & TD_DDIR_READ)
@@ -67,7 +68,8 @@ static inline const char *ddir_str(enum td_ddir ddir)
 {
        static const char *__str[] = { NULL, "read", "write", "rw", "rand",
                                "randread", "randwrite", "randrw",
-                               "trim", NULL, "trimwrite", NULL, "randtrim" };
+                               "trim", NULL, "trimwrite", NULL, "randtrim",
+                               NULL, "randtrimwrite" };
 
        return __str[ddir];
 }
index 5d3daedf341deaf12cdd81d3f888c8cf7351ba6d..a668b0e475f9f013672a089b289bae410acf796e 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1947,6 +1947,10 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                            .oval = TD_DDIR_TRIMWRITE,
                            .help = "Trim and write mix, trims preceding writes"
                          },
+                         { .ival = "randtrimwrite",
+                           .oval = TD_DDIR_RANDTRIMWRITE,
+                           .help = "Randomly trim and write mix, trims preceding writes"
+                         },
                },
        },
        {