All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/7] Replace redundant TD_F_NOIO flag with td->io_ops_init
@ 2017-03-20 21:28 kusumi.tomohiro
  2017-03-20 21:28 ` [PATCH 2/7] Define struct sk_out in server.h (not server.c) kusumi.tomohiro
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: kusumi.tomohiro @ 2017-03-20 21:28 UTC (permalink / raw)
  To: axboe, fio; +Cc: Tomohiro Kusumi

From: Tomohiro Kusumi <tkusumi@tuxera.com>

The only reason TD_F_NOIO exists in addition to FIO_NOIO is because
fio_running_or_pending_io_threads() needs to know whether td has
successfully initialized ioengine, whereas FIO_NOIO is statically
set regardless of ioengines's ->init() result.

This commit adds a new td field ->io_ops_init to inidicate ->init()
result, so that td needs no extra bit field for each ioengine like
TD_F_NOIO. It was rather odd that td was unable to tell ->init()
result afterward when ->init() failure (returning non zero) doesn't
mean aborting fio itself. This commit also changes TD_F_NOIO to
TD_F_RESERVED as it's no longer used.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
---
 fio.h       |  3 ++-
 init.c      |  1 +
 ioengines.c | 14 +++++++-------
 libfio.c    |  2 +-
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/fio.h b/fio.h
index b573ac5..581512f 100644
--- a/fio.h
+++ b/fio.h
@@ -74,7 +74,7 @@ enum {
 	TD_F_VER_NONE		= 1U << 5,
 	TD_F_PROFILE_OPS	= 1U << 6,
 	TD_F_COMPRESS		= 1U << 7,
-	TD_F_NOIO		= 1U << 8,
+	TD_F_RESERVED		= 1U << 8, /* not used */
 	TD_F_COMPRESS_LOG	= 1U << 9,
 	TD_F_VSTATE_SAVED	= 1U << 10,
 	TD_F_NEED_LOCK		= 1U << 11,
@@ -231,6 +231,7 @@ struct thread_data {
 	 * to any of the available IO engines.
 	 */
 	struct ioengine_ops *io_ops;
+	int io_ops_init;
 
 	/*
 	 * IO engine private data and dlhandle.
diff --git a/init.c b/init.c
index b4b0974..4a72255 100644
--- a/init.c
+++ b/init.c
@@ -459,6 +459,7 @@ static struct thread_data *get_new_job(bool global, struct thread_data *parent,
 		copy_opt_list(td, parent);
 
 	td->io_ops = NULL;
+	td->io_ops_init = 0;
 	if (!preserve_eo)
 		td->eo = NULL;
 
diff --git a/ioengines.c b/ioengines.c
index 95013d1..c773f2e 100644
--- a/ioengines.c
+++ b/ioengines.c
@@ -368,17 +368,17 @@ int td_io_init(struct thread_data *td)
 
 	if (td->io_ops->init) {
 		ret = td->io_ops->init(td);
-		if (ret && td->o.iodepth > 1) {
-			log_err("fio: io engine init failed. Perhaps try"
-				" reducing io depth?\n");
-		}
+		if (ret)
+			log_err("fio: io engine %s init failed.%s\n",
+				td->io_ops->name,
+				td->o.iodepth > 1 ?
+				" Perhaps try reducing io depth?" : "");
+		else
+			td->io_ops_init = 1;
 		if (!td->error)
 			td->error = ret;
 	}
 
-	if (!ret && td_ioengine_flagged(td, FIO_NOIO))
-		td->flags |= TD_F_NOIO;
-
 	return ret;
 }
 
diff --git a/libfio.c b/libfio.c
index 4b53c92..8310708 100644
--- a/libfio.c
+++ b/libfio.c
@@ -276,7 +276,7 @@ int fio_running_or_pending_io_threads(void)
 	int nr_io_threads = 0;
 
 	for_each_td(td, i) {
-		if (td->flags & TD_F_NOIO)
+		if (td->io_ops_init && td_ioengine_flagged(td, FIO_NOIO))
 			continue;
 		nr_io_threads++;
 		if (td->runstate < TD_EXITED)
-- 
2.9.3



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-03-21 13:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-20 21:28 [PATCH 1/7] Replace redundant TD_F_NOIO flag with td->io_ops_init kusumi.tomohiro
2017-03-20 21:28 ` [PATCH 2/7] Define struct sk_out in server.h (not server.c) kusumi.tomohiro
2017-03-20 21:28 ` [PATCH 3/7] HOWTO: Mention cpuload= is mandatory for cpuio kusumi.tomohiro
2017-03-20 21:28 ` [PATCH 4/7] HOWTO: Mention fsync=/fsyncdata= are set to 0 by default kusumi.tomohiro
2017-03-20 21:28 ` [PATCH 5/7] Fix a comment after f227e2b6 kusumi.tomohiro
2017-03-20 21:28 ` [PATCH 6/7] Test uint,int before division uint/int for the next i/o kusumi.tomohiro
2017-03-20 21:28 ` [PATCH 7/7] Test fsync/fdatasync/sync_file_range for the next i/o only if should_fsync(td) kusumi.tomohiro
2017-03-21 13:16 ` [PATCH 1/7] Replace redundant TD_F_NOIO flag with td->io_ops_init Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.