New offset_increment option
authorDan Ehrenberg <dehrenberg@google.com>
Thu, 15 Mar 2012 13:44:26 +0000 (14:44 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 15 Mar 2012 13:44:26 +0000 (14:44 +0100)
This patch adds a new option to fio job files. It is described
in the HOWTO as follows:

offset_increment=int If this is provided, then the real offset becomes
the offset + offset_increment * thread_number, where the
thread number is a counter that starts at 0 and is incremented
for each job. This option is useful if there are several jobs
which are intended to operate on a file in parallel in disjoint
segments, with even spacing between the starting points.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
HOWTO
filesetup.c
fio.h
ioengines.c
options.c

diff --git a/HOWTO b/HOWTO
index 0a3351c3f120d5b264f5cca5bcb93e796ed5137b..30e40593a28e59bd87b955c58acf4751b6d3def3 100644 (file)
--- a/HOWTO
+++ b/HOWTO
@@ -636,6 +636,13 @@ offset=int Start io at the given offset in the file. The data before
                the given offset will not be touched. This effectively
                caps the file size at real_size - offset.
 
                the given offset will not be touched. This effectively
                caps the file size at real_size - offset.
 
+offset_increment=int   If this is provided, then the real offset becomes
+               the offset + offset_increment * thread_number, where the
+               thread number is a counter that starts at 0 and is incremented
+               for each job. This option is useful if there are several jobs
+               which are intended to operate on a file in parallel in disjoint
+               segments, with even spacing between the starting points.
+
 fsync=int      If writing to a file, issue a sync of the dirty data
                for every number of blocks given. For example, if you give
                32 as a parameter, fio will sync the file for every 32
 fsync=int      If writing to a file, issue a sync of the dirty data
                for every number of blocks given. For example, if you give
                32 as a parameter, fio will sync the file for every 32
index 446eeaf0801a2772470bb2a47cde0c5368a67d70..9acce64a45fc91eecbce536b89c7dc015dc3a713 100644 (file)
@@ -713,7 +713,8 @@ int setup_files(struct thread_data *td)
        extend_size = total_size = 0;
        need_extend = 0;
        for_each_file(td, f, i) {
        extend_size = total_size = 0;
        need_extend = 0;
        for_each_file(td, f, i) {
-               f->file_offset = td->o.start_offset;
+               f->file_offset = td->o.start_offset +
+                       td->thread_number * td->o.offset_increment;
 
                if (!td->o.file_size_low) {
                        /*
 
                if (!td->o.file_size_low) {
                        /*
diff --git a/fio.h b/fio.h
index 4afdd2d469a1de480b7bea19262bfb7f93565b71..f59265a2a47d22ff31e43ab7ca475fc175043ef3 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -266,6 +266,8 @@ struct thread_options {
        int flow_watermark;
        unsigned int flow_sleep;
 
        int flow_watermark;
        unsigned int flow_sleep;
 
+       unsigned long long offset_increment;
+
        unsigned int sync_file_range;
 };
 
        unsigned int sync_file_range;
 };
 
index 4c609f2b88ae4c537dc90489241808acd711fa1f..1a0898de701e349acdd9f4a2c1337504374334ec 100644 (file)
@@ -278,6 +278,7 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u)
         */
        if (io_u->error == EINVAL && td->io_issues[io_u->ddir & 1] == 1 &&
            td->o.odirect) {
         */
        if (io_u->error == EINVAL && td->io_issues[io_u->ddir & 1] == 1 &&
            td->o.odirect) {
+
                log_info("fio: first direct IO errored. File system may not "
                         "support direct IO, or iomem_align= is bad.\n");
        }
                log_info("fio: first direct IO errored. File system may not "
                         "support direct IO, or iomem_align= is bad.\n");
        }
index 463b66dcd99ea85ddbeb265f5cb17959ab39a53b..e0f6422ba173f14a86f8d4e0b198413accabab29 100644 (file)
--- a/options.c
+++ b/options.c
@@ -2215,6 +2215,13 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                .parent = "flow_id",
                .def    = "0",
        },
                .parent = "flow_id",
                .def    = "0",
        },
+       {
+               .name   = "offset_increment",
+               .type   = FIO_OPT_STR_VAL,
+               .off1   = td_var_offset(offset_increment),
+               .help   = "What is the increment from one offset to the next",
+               .def    = "0",
+       },
        {
                .name = NULL,
        },
        {
                .name = NULL,
        },