From a086c25771b195d04651d293f299f0a63f7d2a23 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 4 Mar 2009 08:27:37 +0100 Subject: [PATCH] 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 --- HOWTO | 4 ++++ fio.h | 4 +++- io_u.c | 11 ++++++++--- options.c | 4 ++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/HOWTO b/HOWTO index 4ff2d929..b8a7dd74 100644 --- 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 e74836f7..11338eb7 100644 --- 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 f2406e8c..0d55c09a 100644 --- 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); diff --git a/options.c b/options.c index fe890df0..cec7bb79 100644 --- 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", }, -- 2.25.1