X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=fio.c;h=fa5deabb6842ed0c527c07e76f68c9c93560e5cc;hp=e1da2c9ed530998d1bc1edea81aec28a9c4d10a4;hb=656b1393d43f9f22738404582ea14dec956aea83;hpb=f2bba1820a567ac00b09916239ac8feb125cead2 diff --git a/fio.c b/fio.c index e1da2c9e..fa5deabb 100644 --- a/fio.c +++ b/fio.c @@ -42,7 +42,8 @@ unsigned long page_mask; unsigned long page_size; -#define ALIGN(buf) \ + +#define PAGE_ALIGN(buf) \ (char *) (((unsigned long) (buf) + page_mask) & ~page_mask) int groupid = 0; @@ -379,8 +380,8 @@ static int break_on_this_error(struct thread_data *td, int *retptr) if (ret < 0 || td->error) { int err; - if (!td->o.continue_on_error); - return 0; + if (!td->o.continue_on_error) + return 1; if (ret < 0) err = -ret; @@ -442,18 +443,17 @@ static void do_verify(struct thread_data *td) while (!td->terminate) { int ret2, full; - io_u = __get_io_u(td); - if (!io_u) - break; - update_tv_cache(td); if (runtime_exceeded(td, &td->tv_cache)) { - put_io_u(td, io_u); td->terminate = 1; break; } + io_u = __get_io_u(td); + if (!io_u) + break; + if (get_next_verify(td, io_u)) { put_io_u(td, io_u); break; @@ -580,18 +580,17 @@ static void do_io(struct thread_data *td) if (td->terminate) break; - io_u = get_io_u(td); - if (!io_u) - break; - update_tv_cache(td); if (runtime_exceeded(td, &td->tv_cache)) { - put_io_u(td, io_u); td->terminate = 1; break; } + io_u = get_io_u(td); + if (!io_u) + break; + /* * Add verification end_io handler, if asked to verify * a previously written file. @@ -792,8 +791,8 @@ static int init_io_u(struct thread_data *td) if (allocate_io_mem(td)) return 1; - if (td->o.odirect) - p = ALIGN(td->orig_buffer); + if (td->o.mem_align) + p = PAGE_ALIGN(td->orig_buffer) + td->o.mem_align; else p = td->orig_buffer; @@ -813,9 +812,11 @@ static int init_io_u(struct thread_data *td) io_u = ptr; memset(io_u, 0, sizeof(*io_u)); INIT_FLIST_HEAD(&io_u->list); + dprint(FD_MEM, "io_u alloc %p, index %u\n", io_u, i); if (!(td->io_ops->flags & FIO_NOIO)) { io_u->buf = p + max_bs * i; + dprint(FD_MEM, "io_u %p, mem %p\n", io_u, io_u->buf); if (td_write(td) && !td->o.refill_buffers) io_u_fill_buffer(td, io_u, max_bs); @@ -1491,7 +1492,13 @@ static void run_threads(void) *fio_debug_jobp = pid; } dprint(FD_MUTEX, "wait on startup_mutex\n"); - fio_mutex_down(startup_mutex); + if (fio_mutex_down_timeout(startup_mutex, 10)) { + log_err("fio: job startup hung? exiting.\n"); + terminate_threads(TERMINATE_ALL); + fio_abort = 1; + nr_started--; + break; + } dprint(FD_MUTEX, "done waiting on startup_mutex\n"); }