Add 'sequential' file_service_type
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>
diff --git a/HOWTO b/HOWTO
index 4ff2d92..b8a7dd7 100644
--- a/HOWTO
+++ b/HOWTO
@@ -387,6 +387,10 @@
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
--- a/fio.h
+++ b/fio.h
@@ -657,11 +657,13 @@
};
/*
- * 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
--- a/io_u.c
+++ b/io_u.c
@@ -681,10 +681,15 @@
}
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);
diff --git a/options.c b/options.c
index fe890df..cec7bb7 100644
--- a/options.c
+++ b/options.c
@@ -871,6 +871,10 @@
.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",
},