Fixes for CPU burn engine
authorJens Axboe <jens.axboe@oracle.com>
Thu, 25 Oct 2007 16:34:02 +0000 (18:34 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Thu, 25 Oct 2007 16:34:02 +0000 (18:34 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
engines/cpu.c
filesetup.c
fio.c
fio.h
init.c

index 14ad9717aa5fbd024a7e9f286a36fd79542c6365..c8eb6b30bf286e03c2a41d712d32e032eb51aa18 100644 (file)
@@ -48,7 +48,7 @@ static struct ioengine_ops ioengine = {
        .queue          = fio_cpuio_queue,
        .init           = fio_cpuio_init,
        .open_file      = fio_cpuio_open,
-       .flags          = FIO_SYNCIO | FIO_DISKLESSIO,
+       .flags          = FIO_SYNCIO | FIO_DISKLESSIO | FIO_NOIO,
 };
 
 static void fio_init fio_cpuio_register(void)
index fca90be71f56b585ed73ce6a90996f74ca6fe030..5134fdbb8af5a52e08e5ad8b60ea820e0caeab9f 100644 (file)
@@ -373,7 +373,8 @@ int setup_files(struct thread_data *td)
        /*
         * device/file sizes are zero and no size given, punt
         */
-       if ((!total_size || total_size == -1ULL) && !td->o.size) {
+       if ((!total_size || total_size == -1ULL) && !td->o.size &&
+           !(td->io_ops->flags & FIO_NOIO)) {
                log_err("%s: you need to specify size=\n", td->o.name);
                td_verror(td, EINVAL, "total_file_size");
                return 1;
diff --git a/fio.c b/fio.c
index 02ed91dbcea0b70454fee2b78b68c5041b49107d..0ec4f5a0e347f975078cb9628e5c81641ad592f4 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -987,12 +987,12 @@ static int fork_main(int shmid, int offset)
 static void reap_threads(int *nr_running, int *t_rate, int *m_rate)
 {
        struct thread_data *td;
-       int i, cputhreads, pending, status, ret;
+       int i, cputhreads, realthreads, pending, status, ret;
 
        /*
         * reap exited threads (TD_EXITED -> TD_REAPED)
         */
-       pending = cputhreads = 0;
+       realthreads = pending = cputhreads = 0;
        for_each_td(td, i) {
                int flags = 0;
 
@@ -1002,6 +1002,8 @@ static void reap_threads(int *nr_running, int *t_rate, int *m_rate)
                 */
                if (td->io_ops && !strcmp(td->io_ops->name, "cpuio"))
                        cputhreads++;
+               else
+                       realthreads++;
 
                if (!td->pid || td->runstate == TD_REAPED)
                        continue;
@@ -1068,7 +1070,7 @@ reaped:
                        exit_value++;
        }
 
-       if (*nr_running == cputhreads && !pending)
+       if (*nr_running == cputhreads && !pending && realthreads)
                terminate_threads(TERMINATE_ALL);
 }
 
diff --git a/fio.h b/fio.h
index 0d57b608c3a29d49f0c8e8008b5c78388a73d110..208f742889753c572880b89948fe9f63c572a202 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -278,6 +278,7 @@ enum fio_ioengine_flags {
        FIO_NOEXTEND    = 1 << 3,       /* engine can't extend file */
        FIO_NODISKUTIL  = 1 << 4,       /* diskutil can't handle filename */
        FIO_UNIDIR      = 1 << 5,       /* engine is uni-directional */
+       FIO_NOIO        = 1 << 6,       /* thread does only pseudo IO */
 };
 
 enum fio_file_flags {
diff --git a/init.c b/init.c
index dc5fed94f86fa17c6e05511f2666108eff1b10b5..201a405b1aa8aef5ac8c16042065e0765b6df2aa 100644 (file)
--- a/init.c
+++ b/init.c
@@ -746,6 +746,7 @@ static int setup_thread_area(void)
                return 1;
        }
 
+       memset(threads, 0, max_jobs * sizeof(struct thread_data));
        atexit(free_shm);
        return 0;
 }