X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=fio.c;h=76c6ebd73b25e0eefb1b093ef5914530ee5b9389;hp=067aa245a04e9d3dd63d2a020b2f72cd33aad975;hb=08d2a19c76b310f68ad2ecab17dff2a2a4c1adf8;hpb=69204d6e8830464bc98fcc28ca91412d6d360775 diff --git a/fio.c b/fio.c index 067aa245..76c6ebd7 100644 --- a/fio.c +++ b/fio.c @@ -45,6 +45,7 @@ #include "cgroup.h" #include "profile.h" #include "lib/rand.h" +#include "memalign.h" unsigned long page_mask; unsigned long page_size; @@ -113,18 +114,12 @@ static void terminate_threads(int group_id) } } -/* - * Happens on thread runs with ctrl-c, ignore our own SIGQUIT - */ -static void sig_quit(int sig) -{ -} - static void sig_int(int sig) { if (threads) { log_info("\nfio: terminating on signal %d\n", sig); fflush(stdout); + exit_value = 128; terminate_threads(TERMINATE_ALL); } } @@ -176,7 +171,7 @@ static void set_sig_handlers(void) sigaction(SIGINT, &act, NULL); memset(&act, 0, sizeof(act)); - act.sa_handler = sig_quit; + act.sa_handler = sig_int; act.sa_flags = SA_RESTART; sigaction(SIGTERM, &act, NULL); } @@ -497,7 +492,6 @@ static void do_verify(struct thread_data *td) clear_io_u(td, io_u); } else if (io_u->resid) { int bytes = io_u->xfer_buflen - io_u->resid; - struct fio_file *f = io_u->file; /* * zero read, fail @@ -515,6 +509,7 @@ static void do_verify(struct thread_data *td) if (ddir_rw(io_u->ddir)) td->ts.short_io_u[io_u->ddir]++; + f = io_u->file; if (io_u->offset == f->real_file_size) goto sync_done; @@ -796,7 +791,7 @@ static void cleanup_io_u(struct thread_data *td) io_u = flist_entry(entry, struct io_u, list); flist_del(&io_u->list); - free(io_u); + fio_memfree(io_u, sizeof(*io_u)); } free_io_mem(td); @@ -843,8 +838,9 @@ static int init_io_u(struct thread_data *td) if (td->terminate) return 1; - if (posix_memalign(&ptr, cl_align, sizeof(*io_u))) { - log_err("fio: posix_memalign=%s\n", strerror(errno)); + ptr = fio_memalign(cl_align, sizeof(*io_u)); + if (!ptr) { + log_err("fio: unable to allocate aligned memory\n"); break; } @@ -1497,14 +1493,14 @@ static void run_threads(void) todo--; } else { struct fio_file *f; - unsigned int i; + unsigned int j; /* * 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) { + for_each_file(td, f, j) { if (fio_file_open(f)) td_io_close_file(td, f); }