X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=io_u.c;h=7941a6d739483edfc5e3b3e81403716133eee97a;hp=6ae3eae817782bd2d82c408b7b74f6dec6d59cf2;hb=8b4e954ca8cf671c25e6df1d675caa34b64f7678;hpb=100f49f105126a26de6f1069679c20fd75194188 diff --git a/io_u.c b/io_u.c index 6ae3eae8..7941a6d7 100644 --- a/io_u.c +++ b/io_u.c @@ -101,7 +101,7 @@ static int __get_next_rand_offset(struct thread_data *td, struct fio_file *f, r = __rand(&td->__random_state); } - dprint(FD_RANDOM, "off rand %llu\n", r); + dprint(FD_RANDOM, "off rand %llu\n", (unsigned long long) r); *b = (lastb - 1) * (r / ((uint64_t) rmax + 1.0)); } else { @@ -125,7 +125,8 @@ static int __get_next_rand_offset(struct thread_data *td, struct fio_file *f, if (random_map_free(f, *b)) goto ret; - dprint(FD_RANDOM, "get_next_rand_offset: offset %llu busy\n", *b); + dprint(FD_RANDOM, "get_next_rand_offset: offset %llu busy\n", + (unsigned long long) *b); *b = axmap_next_free(f->io_axmap, *b); if (*b == (uint64_t) -1ULL) @@ -242,7 +243,8 @@ static int get_next_rand_block(struct thread_data *td, struct fio_file *f, } dprint(FD_IO, "%s: rand offset failed, last=%llu, size=%llu\n", - f->file_name, f->last_pos, f->real_file_size); + f->file_name, (unsigned long long) f->last_pos, + (unsigned long long) f->real_file_size); return 1; } @@ -344,14 +346,16 @@ static int __get_next_offset(struct thread_data *td, struct io_u *io_u) if (io_u->offset >= f->io_size) { dprint(FD_IO, "get_next_offset: offset %llu >= io_size %llu\n", - io_u->offset, f->io_size); + (unsigned long long) io_u->offset, + (unsigned long long) f->io_size); return 1; } io_u->offset += f->file_offset; if (io_u->offset >= f->real_file_size) { dprint(FD_IO, "get_next_offset: offset %llu >= size %llu\n", - io_u->offset, f->real_file_size); + (unsigned long long) io_u->offset, + (unsigned long long) f->real_file_size); return 1; } @@ -497,7 +501,7 @@ static enum fio_ddir rate_ddir(struct thread_data *td, enum fio_ddir ddir) * We have too much pending sleep in this direction. See if we * should switch. */ - if (td_rw(td)) { + if (td_rw(td) && td->o.rwmix[odir]) { /* * Other direction does not have too much pending, switch */ @@ -527,10 +531,10 @@ static enum fio_ddir rate_ddir(struct thread_data *td, enum fio_ddir ddir) * io's that have been actually submitted to an async engine, * and cur_depth is meaningless for sync engines. */ - if (td->io_u_in_flight) { + while (td->io_u_in_flight) { int fio_unused ret; - ret = io_u_queued_complete(td, td->io_u_in_flight, NULL); + ret = io_u_queued_complete(td, 1, NULL); } fio_gettime(&t, NULL); @@ -545,6 +549,7 @@ static enum fio_ddir rate_ddir(struct thread_data *td, enum fio_ddir ddir) if (ddir_trim(ddir)) return ddir; + return ddir; } @@ -715,8 +720,9 @@ static int fill_io_u(struct thread_data *td, struct io_u *io_u) if (io_u->offset + io_u->buflen > io_u->file->real_file_size) { dprint(FD_IO, "io_u %p, offset too large\n", io_u); - dprint(FD_IO, " off=%llu/%lu > %llu\n", io_u->offset, - io_u->buflen, io_u->file->real_file_size); + dprint(FD_IO, " off=%llu/%lu > %llu\n", + (unsigned long long) io_u->offset, io_u->buflen, + (unsigned long long) io_u->file->real_file_size); return 1; }