X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=fio.c;h=841b59a5ae3111c588338b10ef9c2477d6f5740e;hp=0ec4f5a0e347f975078cb9628e5c81641ad592f4;hb=2ba1c290d09af6d630d84a58b97b8032f73bc2ce;hpb=5a32012f174baf33978b041cffa36453f2d92947 diff --git a/fio.c b/fio.c index 0ec4f5a0..841b59a5 100644 --- a/fio.c +++ b/fio.c @@ -60,6 +60,8 @@ struct io_log *agg_io_log[2]; static inline void td_set_runstate(struct thread_data *td, int runstate) { + dprint(FD_PROCESS, "%d: runstate %d -> %d\n", td->pid, td->runstate, + runstate); td->runstate = runstate; } @@ -70,6 +72,7 @@ static void terminate_threads(int group_id) for_each_td(td, i) { if (group_id == TERMINATE_ALL || groupid == td->groupid) { + dprint(FD_PROCESS, "setting terminate on %d\n",td->pid); /* * if the thread is running, just let it exit */ @@ -568,6 +571,10 @@ sync_done: } } + if (td->o.fill_device && td->error == ENOSPC) { + td->error = 0; + td->terminate = 1; + } if (!td->error) { struct fio_file *f; @@ -586,6 +593,12 @@ sync_done: } } else cleanup_pending_aio(td); + + /* + * stop job if we failed doing any IO + */ + if ((td->this_io_bytes[0] + td->this_io_bytes[1]) == 0) + td->done = 1; } static void cleanup_io_u(struct thread_data *td) @@ -657,10 +670,12 @@ static int init_io_u(struct thread_data *td) memset(io_u, 0, sizeof(*io_u)); INIT_LIST_HEAD(&io_u->list); - io_u->buf = p + max_bs * i; + if (!(td->io_ops->flags & FIO_NOIO)) { + io_u->buf = p + max_bs * i; - if (td_write(td)) - fill_io_buf(td, io_u, max_bs); + if (td_write(td)) + fill_io_buf(td, io_u, max_bs); + } io_u->index = i; io_u->flags = IO_U_F_FREE; @@ -762,7 +777,10 @@ static int clear_io_state(struct thread_data *td) td->last_was_sync = 0; - if (td->o.time_based) + /* + * reset file done count if we are to start over + */ + if (td->o.time_based || td->o.loops) td->nr_done_files = 0; for_each_file(td, f, i) @@ -785,9 +803,8 @@ static int clear_io_state(struct thread_data *td) */ static void *thread_main(void *data) { - unsigned long long runtime[2]; + unsigned long long runtime[2], elapsed; struct thread_data *td = data; - unsigned long elapsed; int clear_state; if (!td->o.use_thread) @@ -795,6 +812,8 @@ static void *thread_main(void *data) td->pid = getpid(); + dprint(FD_PROCESS, "jobs pid=%d started\n", td->pid); + INIT_LIST_HEAD(&td->io_u_freelist); INIT_LIST_HEAD(&td->io_u_busylist); INIT_LIST_HEAD(&td->io_u_requeues); @@ -827,7 +846,7 @@ static void *thread_main(void *data) goto err; } - if (td->ioprio) { + if (td->ioprio_set) { if (ioprio_set(IOPRIO_WHO_PROCESS, 0, td->ioprio) == -1) { td_verror(td, errno, "ioprio_set"); goto err; @@ -1057,8 +1076,11 @@ reaped: if (td->o.use_thread) { long ret; - if (pthread_join(td->thread, (void *) &ret)) + dprint(FD_PROCESS, "joining tread %d\n", td->pid); + if (pthread_join(td->thread, (void *) &ret)) { + dprint(FD_PROCESS, "join failed %ld\n", ret); perror("pthread_join"); + } } (*nr_running)--; @@ -1173,12 +1195,14 @@ static void run_threads(void) nr_started++; if (td->o.use_thread) { + dprint(FD_PROCESS, "will pthread_create\n"); if (pthread_create(&td->thread, NULL, thread_main, td)) { perror("thread_create"); nr_started--; break; } } else { + dprint(FD_PROCESS, "will fork\n"); if (!fork()) { int ret = fork_main(shm_id, i);