[PATCH] fio: misc fixes
authorJens Axboe <axboe@suse.de>
Tue, 6 Dec 2005 20:32:39 +0000 (21:32 +0100)
committerJens Axboe <axboe@suse.de>
Tue, 6 Dec 2005 20:32:39 +0000 (21:32 +0100)
- Only use threads for > 1 thread
- Don't clear ->iodepth for SYNCIO def_thread
- Only use setsid() for forked threads

fio-ini.c
fio-io.c
fio.c

index e1d452317b983d9fed0cad15eed61aeafa8cd10c..d35909d8fe8734afba3c7009e8fd01b31f67cd36 100644 (file)
--- 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;
index e198e64ddd9b0bf3d49087961a4938b3c5c213d3..3792a9bd50e712cd03481355e29ac49ef0ae0839 100644 (file)
--- 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 52ad7a6406fa2ae4b58f208105110c366286df06..cc5a9da315bf5f902d309056b0a2a5fcf5fd5210 100644 (file)
--- 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);