Add 'sequential' file_service_type
authorJens Axboe <jens.axboe@oracle.com>
Wed, 4 Mar 2009 07:27:37 +0000 (08:27 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 4 Mar 2009 07:27:37 +0000 (08:27 +0100)
This service type will keep a file open until IO to it is completely
done, before moving on to the next available file.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
HOWTO
fio.h
io_u.c
options.c

diff --git a/HOWTO b/HOWTO
index 4ff2d92936be3be076c3a3999e8d3f13719cbfbc..b8a7dd74bae68d207466c6a672da818f5238215a 100644 (file)
--- a/HOWTO
+++ b/HOWTO
@@ -387,6 +387,10 @@ file_service_type=str  Defines how fio decides which file from a job to
                        roundrobin  Round robin over open files. This
                                is the default.
 
                        roundrobin  Round robin over open files. This
                                is the default.
 
+                       sequential  Finish one file before moving on to
+                               the next. Multiple files can still be
+                               open depending on 'openfiles'.
+
                The string can have a number appended, indicating how
                often to switch to a new file. So if option random:4 is
                given, fio will switch to a new random file after 4 ios
                The string can have a number appended, indicating how
                often to switch to a new file. So if option random:4 is
                given, fio will switch to a new random file after 4 ios
diff --git a/fio.h b/fio.h
index e74836f7bc881720f7b7bef984c879ea5179c726..11338eb7496e64d3207eb240dd3182b154b241ad 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -657,11 +657,13 @@ struct thread_data {
 };
 
 /*
 };
 
 /*
- * roundrobin available files, or choose one at random.
+ * roundrobin available files, or choose one at random, or do each one
+ * serially.
  */
 enum {
        FIO_FSERVICE_RANDOM     = 1,
        FIO_FSERVICE_RR         = 2,
  */
 enum {
        FIO_FSERVICE_RANDOM     = 1,
        FIO_FSERVICE_RR         = 2,
+       FIO_FSERVICE_SEQ        = 3,
 };
 
 /*
 };
 
 /*
diff --git a/io_u.c b/io_u.c
index f2406e8c1ec91cb86f56196b2f83e33dca9087ca..0d55c09ae59dd2c70ea60313dff4bc1ddfef29a6 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -681,10 +681,15 @@ static struct fio_file *get_next_file(struct thread_data *td)
        }
 
        f = td->file_service_file;
        }
 
        f = td->file_service_file;
-       if (f && (f->flags & FIO_FILE_OPEN) && td->file_service_left--)
-               goto out;
+       if (f && (f->flags & FIO_FILE_OPEN)) {
+               if (td->o.file_service_type == FIO_FSERVICE_SEQ)
+                       goto out;
+               if (td->file_service_left--)
+                       goto out;
+       }
 
 
-       if (td->o.file_service_type == FIO_FSERVICE_RR)
+       if (td->o.file_service_type == FIO_FSERVICE_RR ||
+           td->o.file_service_type == FIO_FSERVICE_SEQ)
                f = get_next_file_rr(td, FIO_FILE_OPEN, FIO_FILE_CLOSING);
        else
                f = get_next_file_rand(td, FIO_FILE_OPEN, FIO_FILE_CLOSING);
                f = get_next_file_rr(td, FIO_FILE_OPEN, FIO_FILE_CLOSING);
        else
                f = get_next_file_rand(td, FIO_FILE_OPEN, FIO_FILE_CLOSING);
index fe890df026e733c64025e432910a93194a79d6b8..cec7bb79d2422b19f79df258b784c0ab033fbc4b 100644 (file)
--- a/options.c
+++ b/options.c
@@ -871,6 +871,10 @@ static struct fio_option options[] = {
                            .oval = FIO_FSERVICE_RR,
                            .help = "Round robin select files",
                          },
                            .oval = FIO_FSERVICE_RR,
                            .help = "Round robin select files",
                          },
+                         { .ival = "sequential",
+                           .oval = FIO_FSERVICE_SEQ,
+                           .help = "Finish one file before moving to the next",
+                         },
                },
                .parent = "nrfiles",
        },
                },
                .parent = "nrfiles",
        },