[PATCH] Allow io engine to do the file setup
authorJens Axboe <jens.axboe@oracle.com>
Tue, 10 Oct 2006 06:30:24 +0000 (08:30 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 10 Oct 2006 06:30:24 +0000 (08:30 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
engines/fio-engine-cpu.c
fio.c
fio.h

index 6d6fc562d93d792eb2a59de1f5a7df31772d5c4a..9a32330e2352ddf29d6e84b2fca86d959cb33aaa 100644 (file)
@@ -1,6 +1,11 @@
 #include "fio.h"
 #include "os.h"
 
+static int fio_cpuio_setup(struct thread_data fio_unused *td)
+{
+       return 0;
+}
+
 static int fio_cpuio_init(struct thread_data *td)
 {
        if (!td->cpuload) {
@@ -19,5 +24,6 @@ struct ioengine_ops ioengine = {
        .name           = "cpuio",
        .version        = FIO_IOOPS_VERSION,
        .init           = fio_cpuio_init,
+       .setup          = fio_cpuio_setup,
        .flags          = FIO_CPUIO,
 };
diff --git a/fio.c b/fio.c
index 8278b60eb46dc2c7310d929ba00fd248620e565e..ea57d78308b149491f61a39e9e2caeb8dd2de552 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -1210,8 +1210,8 @@ static int setup_file(struct thread_data *td)
        struct stat st;
        int flags = 0;
 
-       if (td->io_ops->flags & FIO_CPUIO)
-               return 0;
+       if (td->io_ops->setup)
+               return td->io_ops->setup(td);
 
        if (stat(td->file_name, &st) == -1) {
                if (errno != ENOENT) {
diff --git a/fio.h b/fio.h
index 112736c81a360b265bd25c26820734f743ee34eb..db39ea125ec31a9c74bdde4d23c51648e353cff9 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -455,6 +455,7 @@ struct ioengine_ops {
        char name[16];
        int version;
        int flags;
+       int (*setup)(struct thread_data *);
        int (*init)(struct thread_data *);
        int (*prep)(struct thread_data *, struct io_u *);
        int (*queue)(struct thread_data *, struct io_u *);