summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@suse.de>2005-12-06 21:32:39 +0100
committerJens Axboe <axboe@suse.de>2005-12-06 21:32:39 +0100
commit2572cf2ab8d86803882fa52802b091702512777f (patch)
treeea8a95fcef7b97826725a2f9c2fdcea167b8a6b4
parentbe067bcec0b42ec067e94d42a5039cbe2ce7eeb1 (diff)
[PATCH] fio: misc fixes
- Only use threads for > 1 thread - Don't clear ->iodepth for SYNCIO def_thread - Only use setsid() for forked threads
-rw-r--r--fio-ini.c14
-rw-r--r--fio-io.c4
-rw-r--r--fio.c6
3 files changed, 15 insertions, 9 deletions
diff --git a/fio-ini.c b/fio-ini.c
index e1d4523..d35909d 100644
--- a/fio-ini.c
+++ b/fio-ini.c
@@ -160,13 +160,6 @@ static int add_job(struct thread_data *td, const char *jobname, int prioclass,
struct stat sb;
int numjobs;
- if (td->io_engine & FIO_SYNCIO)
- td->iodepth = 1;
- else {
- if (!td->iodepth)
- td->iodepth = 1;
- }
-
#ifndef FIO_HAVE_LIBAIO
if (td->io_engine == FIO_LIBAIO) {
fprintf(stderr, "Linux libaio not available\n");
@@ -189,6 +182,13 @@ static int add_job(struct thread_data *td, const char *jobname, int prioclass,
if (td == &def_thread)
return 0;
+ if (td->io_engine & FIO_SYNCIO)
+ td->iodepth = 1;
+ else {
+ if (!td->iodepth)
+ td->iodepth = 1;
+ }
+
td->filetype = FIO_TYPE_FILE;
if (!stat(jobname, &sb) && S_ISBLK(sb.st_mode))
td->filetype = FIO_TYPE_BD;
diff --git a/fio-io.c b/fio-io.c
index e198e64..3792a9b 100644
--- a/fio-io.c
+++ b/fio-io.c
@@ -4,6 +4,10 @@
*
* sync io is implemented on top of aio.
*
+ * This is not really specific to fio, if the get_io_u/put_io_u and
+ * structures was pulled into this as well it would be a perfectly
+ * generic io engine that could be used for other projects.
+ *
*/
#include <stdio.h>
#include <stdlib.h>
diff --git a/fio.c b/fio.c
index 52ad7a6..cc5a9da 100644
--- a/fio.c
+++ b/fio.c
@@ -1605,7 +1605,9 @@ static void *thread_main(void *data)
struct thread_data *td = data;
int ret = 1;
- setsid();
+ if (!td->use_thread)
+ setsid();
+
td->pid = getpid();
if (init_io_u(td))
@@ -1858,7 +1860,7 @@ static void run_threads(void)
unsigned long spent;
int i, todo, nr_running, m_rate, t_rate, nr_started;
- printf("Starting %d threads\n", thread_number);
+ printf("Starting %d thread%s\n", thread_number, thread_number > 1 ? "s" : "");
fflush(stdout);
signal(SIGINT, sig_handler);