From a9defc9abb4a3013335d3aeeb132fd90900cac85 Mon Sep 17 00:00:00 2001 From: Joel Becker Date: Thu, 1 Mar 2007 08:26:38 +0100 Subject: [PATCH] [PATCH] ioengine flags: Replace FIO_NETIO with real flags that map the behavior The FIO_NETIO ioengine flag created two behaviors. First, open_files() would not open any files - this was handled in engines/net:setup(). Second, init_disk_util() would ignore the files and not try to locate their disk. Other engines might want one of these behaviors but not the other. If an engine opens its own files, it doesn't want open_files() to do anything, even if the files are eventually disk-based. An engine might want to prevent init_disk_util() from running. The FIO_NETIO flag is split into two flags. FIO_SELFOPEN states that the engine will do its own open(), whether it is a real open(2) or something internal to the engine. FIO_DISKLESSIO states that init_disk_util() is should not be run. fio should treat the engine's files as if they are not part of a disk. Finally, engines/net.c is changed to use these two flags. Signed-off-by: Joel Becker Signed-off-by: Jens Axboe --- engines/net.c | 2 +- filesetup.c | 2 +- fio.h | 5 +++-- stat.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/engines/net.c b/engines/net.c index 60a68778..b3d847bf 100644 --- a/engines/net.c +++ b/engines/net.c @@ -269,7 +269,7 @@ static struct ioengine_ops ioengine = { .prep = fio_netio_prep, .queue = fio_netio_queue, .setup = fio_netio_setup, - .flags = FIO_SYNCIO | FIO_NETIO, + .flags = FIO_SYNCIO | FIO_DISKLESSIO | FIO_SELFOPEN, }; static void fio_init fio_netio_register(void) diff --git a/filesetup.c b/filesetup.c index d8135ef0..cf9fa3c4 100644 --- a/filesetup.c +++ b/filesetup.c @@ -347,7 +347,7 @@ static int setup_file(struct thread_data *td, struct fio_file *f) { int flags = 0; - if (td->io_ops->flags & FIO_NETIO) + if (td->io_ops->flags & FIO_SELFOPEN) return 0; /* diff --git a/fio.h b/fio.h index 4eabfbcb..f8f9a5e4 100644 --- a/fio.h +++ b/fio.h @@ -214,8 +214,9 @@ enum fio_ioengine_flags { FIO_CPUIO = 1 << 1, /* cpu burner, doesn't do real io */ FIO_MMAPIO = 1 << 2, /* uses memory mapped io */ FIO_RAWIO = 1 << 3, /* some sort of direct/raw io */ - FIO_NETIO = 1 << 4, /* networked io */ - FIO_NULLIO = 1 << 5, /* no real data transfer (cpu/null) */ + FIO_DISKLESSIO = 1 << 4, /* no disk involved */ + FIO_SELFOPEN = 1 << 5, /* opens its own devices */ + FIO_NULLIO = 1 << 6, /* no real data transfer (cpu/null) */ }; /* diff --git a/stat.c b/stat.c index a8f2b026..ec418da9 100644 --- a/stat.c +++ b/stat.c @@ -246,7 +246,7 @@ void init_disk_util(struct thread_data *td) dev_t dev; char *p; - if (!td->do_disk_util || (td->io_ops->flags & (FIO_NETIO | FIO_NULLIO))) + if (!td->do_disk_util || (td->io_ops->flags & (FIO_DISKLESSIO | FIO_NULLIO))) return; /* -- 2.25.1