Add create_only option
authorJens Axboe <axboe@kernel.dk>
Wed, 2 May 2012 11:58:02 +0000 (13:58 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 2 May 2012 11:58:02 +0000 (13:58 +0200)
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 <gschoenberger@thomas-krenn.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
HOWTO
filesetup.c
fio.1
fio.h
options.c

diff --git a/HOWTO b/HOWTO
index aa5a6f0debf507b25369a96b5fb94a3290fa667e..025443be406669ece150b28858c67ed9cb2f56d9 100644 (file)
--- 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
index f3d38290179e80d9eacefb5f2a97ef4abd479720..a1ad02633f10d2871adc8d93dc83e833f3afa340 100644 (file)
@@ -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 969c4a145210418ed5f0823f30a3cf13d4a8e85a..77c8d9b81796f6ae662d8a4c1f99d29a692d5d80 100644 (file)
--- 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 6da22f039c8b1216762ec7ae349fb66b0d5bf229..f2a5a1f1ee70b91353734c9c5f8f8308ca10d338 100644 (file)
--- 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;
index f8927ee803b6da4c71a84fe1b18422675d927997..28a228c6fefbb5ec7bab60ef8afc225685f70609 100644 (file)
--- 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,