X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=backend.c;h=814d244cadf241028efdf268692201ce6c9a84aa;hp=6e0e4424d6f6ce31d32ff6cf5d2ca77ba09111c2;hb=f7078f7b517ace62bdf22967c18525b5b6c68b85;hpb=649c10c59b016ae8586e54746d3761bc6df33c9b diff --git a/backend.c b/backend.c index 6e0e4424..814d244c 100644 --- a/backend.c +++ b/backend.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -67,7 +68,7 @@ int temp_stall_ts; unsigned long done_secs = 0; #define PAGE_ALIGN(buf) \ - (char *) (((unsigned long) (buf) + page_mask) & ~page_mask) + (char *) (((uintptr_t) (buf) + page_mask) & ~page_mask) #define JOB_START_TIMEOUT (5 * 1000) @@ -408,6 +409,9 @@ static void do_verify(struct thread_data *td) } } + if (flow_threshold_exceeded(td)) + continue; + io_u = __get_io_u(td); if (!io_u) break; @@ -522,6 +526,20 @@ sync_done: dprint(FD_VERIFY, "exiting loop\n"); } +static int io_bytes_exceeded(struct thread_data *td) +{ + unsigned long long bytes; + + if (td_rw(td)) + bytes = td->this_io_bytes[0] + td->this_io_bytes[1]; + else if (td_write(td)) + bytes = td->this_io_bytes[1]; + else + bytes = td->this_io_bytes[0]; + + return bytes >= td->o.size; +} + /* * Main IO worker function. It retrieves io_u's to process and queues * and reaps them, checking for rate and errors along the way. @@ -536,9 +554,8 @@ static void do_io(struct thread_data *td) else td_set_runstate(td, TD_RUNNING); - while ( (td->o.read_iolog_file && !flist_empty(&td->io_log_list)) || - (!flist_empty(&td->trim_list)) || - ((td->this_io_bytes[0] + td->this_io_bytes[1]) < td->o.size) ) { + while ((td->o.read_iolog_file && !flist_empty(&td->io_log_list)) || + (!flist_empty(&td->trim_list)) || !io_bytes_exceeded(td)) { struct timeval comp_time; unsigned long bytes_done[2] = { 0, 0 }; int min_evts = 0; @@ -559,6 +576,9 @@ static void do_io(struct thread_data *td) } } + if (flow_threshold_exceeded(td)) + continue; + io_u = get_io_u(td); if (!io_u) break; @@ -755,12 +775,13 @@ static void cleanup_io_u(struct thread_data *td) static int init_io_u(struct thread_data *td) { struct io_u *io_u; - unsigned int max_bs; + unsigned int max_bs, min_write; int cl_align, i, max_units; char *p; max_units = td->o.iodepth; max_bs = max(td->o.max_bs[DDIR_READ], td->o.max_bs[DDIR_WRITE]); + min_write = td->o.min_bs[DDIR_WRITE]; td->orig_buffer_size = (unsigned long long) max_bs * (unsigned long long) max_units; @@ -809,7 +830,7 @@ static int init_io_u(struct thread_data *td) dprint(FD_MEM, "io_u %p, mem %p\n", io_u, io_u->buf); if (td_write(td)) - io_u_fill_buffer(td, io_u, max_bs); + io_u_fill_buffer(td, io_u, min_write, max_bs); if (td_write(td) && td->o.verify_pattern_bytes) { /* * Fill the buffer with the pattern if we are @@ -1179,7 +1200,7 @@ err: write_iolog_close(td); td_set_runstate(td, TD_EXITED); - return (void *) (unsigned long) td->error; + return (void *) (uintptr_t) td->error; } @@ -1210,7 +1231,7 @@ static int fork_main(int shmid, int offset) td = data + offset * sizeof(struct thread_data); ret = thread_main(td); shmdt(data); - return (int) (unsigned long) ret; + return (int) (uintptr_t) ret; } /*