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 4ff2d92..b8a7dd7 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.
 
+                       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
diff --git a/fio.h b/fio.h
index e74836f..11338eb 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,
+       FIO_FSERVICE_SEQ        = 3,
 };
 
 /*
diff --git a/io_u.c b/io_u.c
index f2406e8..0d55c09 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;
-       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);
index fe890df..cec7bb7 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",
                          },
+                         { .ival = "sequential",
+                           .oval = FIO_FSERVICE_SEQ,
+                           .help = "Finish one file before moving to the next",
+                         },
                },
                .parent = "nrfiles",
        },