X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=fio.c;h=de6132c034a3daa04a64c0b4e60967ccbf99d331;hb=380065aa652b87093d6bbd240e70db30bd6f193d;hp=1594bf64e5976c8a4d107aa2768d50bde0ca0404;hpb=cdd18ad87ed9a3639b76c41cfc9682ad7cce652e;p=fio.git diff --git a/fio.c b/fio.c index 1594bf64..de6132c0 100644 --- a/fio.c +++ b/fio.c @@ -36,6 +36,7 @@ #include "fio.h" #include "hash.h" +#include "smalloc.h" unsigned long page_mask; unsigned long page_size; @@ -82,8 +83,12 @@ static void terminate_threads(int group_id) */ if (td->runstate < TD_RUNNING) kill(td->pid, SIGQUIT); - else if (td->io_ops->flags & FIO_SIGQUIT) - kill(td->pid, SIGQUIT); + else { + struct ioengine_ops *ops = td->io_ops; + + if (ops && (ops->flags & FIO_SIGQUIT)) + kill(td->pid, SIGQUIT); + } } } } @@ -355,7 +360,6 @@ static void do_verify(struct thread_data *td) io_u->xfer_buflen = io_u->resid; io_u->xfer_buf += bytes; io_u->offset += bytes; - f->last_completed_pos = io_u->offset; td->ts.short_io_u[io_u->ddir]++; @@ -481,7 +485,6 @@ static void do_io(struct thread_data *td) io_u->xfer_buflen = io_u->resid; io_u->xfer_buf += bytes; io_u->offset += bytes; - f->last_completed_pos = io_u->offset; td->ts.short_io_u[io_u->ddir]++; @@ -783,8 +786,7 @@ static int clear_io_state(struct thread_data *td) if (td->o.time_based || td->o.loops) td->nr_done_files = 0; - for_each_file(td, f, i) - td_io_close_file(td, f); + close_files(td); ret = 0; for_each_file(td, f, i) { @@ -962,7 +964,7 @@ static void *thread_main(void *data) err: if (td->error) printf("fio: pid=%d, err=%d/%s\n", td->pid, td->error, td->verror); - close_files(td); + close_and_free_files(td); close_ioengine(td); cleanup_io_u(td); @@ -1152,7 +1154,18 @@ static void run_threads(void) log_err("fio: pid=%d, err=%d/%s\n", td->pid, td->error, td->verror); td_set_runstate(td, TD_REAPED); todo--; - } + } else { + struct fio_file *f; + unsigned int i; + + /* + * for sharing to work, each job must always open + * its own files. so close them, if we opened them + * for creation + */ + for_each_file(td, f, i) + td_io_close_file(td, f); + } init_disk_util(td); } @@ -1290,6 +1303,8 @@ int main(int argc, char *argv[]) { long ps; + sinit(); + /* * We need locale for number printing, if it isn't set then just * go with the US format.