X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=fio.c;h=89cc5996ca8854c9b9c655a232a366e8d278c9d7;hp=9fabbe93bc53a7887cc6457371b55ea202ff3ebc;hb=0798ba36674a7a244e8bc10877e322973a5ca938;hpb=38d77caebcb6f9cb33f247a341c162c0185bf604 diff --git a/fio.c b/fio.c index 9fabbe93..89cc5996 100644 --- a/fio.c +++ b/fio.c @@ -35,7 +35,6 @@ #include #include "fio.h" -#include "os.h" unsigned long page_mask; unsigned long page_size; @@ -342,10 +341,17 @@ static void do_verify(struct thread_data *td) put_io_u(td, io_u); break; } + io_u->xfer_buflen = io_u->resid; io_u->xfer_buf += bytes; + io_u->offset += bytes; + + if (io_u->offset == io_u->file->real_file_size) + goto sync_done; + requeue_io_u(td, &io_u); } else { +sync_done: ret = io_u_sync_complete(td, io_u); if (ret < 0) break; @@ -412,7 +418,7 @@ static void do_io(struct thread_data *td) td_set_runstate(td, TD_RUNNING); - while ((td->this_io_bytes[0] + td->this_io_bytes[1]) < td->io_size) { + while ((td->this_io_bytes[0] + td->this_io_bytes[1]) < td->o.size) { struct timeval comp_time; long bytes_done = 0; int min_evts = 0; @@ -452,8 +458,14 @@ static void do_io(struct thread_data *td) io_u->xfer_buflen = io_u->resid; io_u->xfer_buf += bytes; + io_u->offset += bytes; + + if (io_u->offset == io_u->file->real_file_size) + goto sync_done; + requeue_io_u(td, &io_u); } else { +sync_done: fio_gettime(&comp_time, NULL); bytes_done = io_u_sync_complete(td, io_u); if (bytes_done < 0) @@ -735,8 +747,9 @@ static void *thread_main(void *data) INIT_LIST_HEAD(&td->io_u_freelist); INIT_LIST_HEAD(&td->io_u_busylist); INIT_LIST_HEAD(&td->io_u_requeues); - INIT_LIST_HEAD(&td->io_hist_list); INIT_LIST_HEAD(&td->io_log_list); + INIT_LIST_HEAD(&td->io_hist_list); + td->io_hist_tree = RB_ROOT; if (init_io_u(td)) goto err_sem; @@ -878,6 +891,7 @@ err: close_files(td); close_ioengine(td); cleanup_io_u(td); + options_mem_free(td); td_set_runstate(td, TD_EXITED); return (void *) (unsigned long) td->error; err_sem: @@ -1195,10 +1209,8 @@ int main(int argc, char *argv[]) if (parse_options(argc, argv)) return 1; - if (!thread_number) { - log_err("Nothing to do\n"); - return 1; - } + if (!thread_number) + return 0; ps = sysconf(_SC_PAGESIZE); if (ps < 0) {