From 25460cf6350fb90b8a7943bb649a51d81bac13a4 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 2 May 2012 13:58:02 +0200 Subject: [PATCH] Add create_only option MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If this option is set, then fio will only run the preparation phase of a job. This means it will create all the files it needs, but exit after that. Suggested-by: Georg Schönberger Signed-off-by: Jens Axboe --- HOWTO | 5 +++++ filesetup.c | 7 ++++++- fio.1 | 5 +++++ fio.h | 1 + options.c | 7 +++++++ 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/HOWTO b/HOWTO index aa5a6f0d..025443be 100644 --- a/HOWTO +++ b/HOWTO @@ -893,6 +893,11 @@ create_fsync=bool fsync the data file after creation. This is the create_on_open=bool Don't pre-setup the files for IO, just create open() when it's time to do IO to that file. +create_only=bool If true, fio will only run the setup phase of the job. + If files need to be laid out or updated on disk, only + that will be done. The actual job contents are not + executed. + pre_read=bool If this is given, files will be pre-read into memory before starting the given IO operation. This will also clear the 'invalidate' flag, since it is pointless to pre-read diff --git a/filesetup.c b/filesetup.c index f3d38290..a1ad0263 100644 --- a/filesetup.c +++ b/filesetup.c @@ -665,7 +665,7 @@ int setup_files(struct thread_data *td) dprint(FD_FILE, "setup files\n"); if (td->o.read_iolog_file) - return 0; + goto done; /* * if ioengine defines a setup() method, it's responsible for @@ -816,6 +816,11 @@ int setup_files(struct thread_data *td) */ if (!td->o.read_iolog_file) td->total_io_size = td->o.size * td->o.loops; + +done: + if (td->o.create_only) + td->done = 1; + return 0; err_offset: log_err("%s: you need to specify valid offset=\n", td->o.name); diff --git a/fio.1 b/fio.1 index 969c4a14..77c8d9b8 100644 --- a/fio.1 +++ b/fio.1 @@ -725,6 +725,11 @@ If true, serialize file creation for the jobs. Default: true. .BI create_on_open \fR=\fPbool If true, the files are not created until they are opened for IO by the job. .TP +.BI create_only \fR=\fPbool +If true, fio will only run the setup phase of the job. If files need to be +laid out or updated on disk, only that will be done. The actual job contents +are not executed. +.TP .BI pre_read \fR=\fPbool If this is given, files will be pre-read into memory before starting the given IO operation. This will also clear the \fR \fBinvalidate\fR flag, since it is diff --git a/fio.h b/fio.h index 6da22f03..f2a5a1f1 100644 --- a/fio.h +++ b/fio.h @@ -125,6 +125,7 @@ struct thread_options { unsigned int create_serialize; unsigned int create_fsync; unsigned int create_on_open; + unsigned int create_only; unsigned int end_fsync; unsigned int pre_read; unsigned int sync_io; diff --git a/options.c b/options.c index f8927ee8..28a228c6 100644 --- a/options.c +++ b/options.c @@ -1884,6 +1884,13 @@ static struct fio_option options[FIO_MAX_OPTS] = { .help = "Create files when they are opened for IO", .def = "0", }, + { + .name = "create_only", + .type = FIO_OPT_BOOL, + .off1 = td_var_offset(create_only), + .help = "Only perform file creation phase", + .def = "0", + }, { .name = "pre_read", .type = FIO_OPT_BOOL, -- 2.25.1