X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;ds=sidebyside;f=io_u.c;h=834e5d214d5da390365858f36d67ed3fd67127a6;hb=d2324417d8a06b0d0b7c331a0d004155f3a7bd48;hp=8ec9dd9ecbfdd9b721b7a0b905fdbee9b89c5a84;hpb=02bcaa8c31feb93c61b701d143a7eea3efd2124d;p=fio.git diff --git a/io_u.c b/io_u.c index 8ec9dd9e..834e5d21 100644 --- a/io_u.c +++ b/io_u.c @@ -63,7 +63,7 @@ static int get_next_free_block(struct thread_data *td, struct fio_file *f, *b = 0; i = 0; - while ((*b) * td->rw_min_bs < f->file_size) { + while ((*b) * td->rw_min_bs < f->real_file_size) { if (f->file_map[i] != -1UL) { *b += ffz(f->file_map[i]); return 0; @@ -108,7 +108,7 @@ static int get_next_offset(struct thread_data *td, struct fio_file *f, b = f->last_pos / td->min_bs[ddir]; *offset = (b * td->min_bs[ddir]) + f->file_offset; - if (*offset > f->file_size) + if (*offset > f->real_file_size) return 1; return 0; @@ -123,7 +123,7 @@ static unsigned int get_next_buflen(struct thread_data *td, int ddir) buflen = td->min_bs[ddir]; else { r = os_random_long(&td->bsrange_state); - buflen = (1 + (double) (td->max_bs[ddir] - 1) * r / (RAND_MAX + 1.0)); + buflen = (unsigned int) (1 + (double) (td->max_bs[ddir] - 1) * r / (RAND_MAX + 1.0)); if (!td->bs_unaligned) buflen = (buflen + td->min_bs[ddir] - 1) & ~(td->min_bs[ddir] - 1); } @@ -147,7 +147,7 @@ static unsigned int get_next_buflen(struct thread_data *td, int ddir) * mixed read/write workload, check the rwmix cycle and switch if * necessary. */ -static int get_rw_ddir(struct thread_data *td) +static enum fio_ddir get_rw_ddir(struct thread_data *td) { if (td_rw(td)) { struct timeval now; @@ -267,13 +267,13 @@ struct io_u *get_io_u(struct thread_data *td, struct fio_file *f) return NULL; } - if (io_u->buflen + io_u->offset > f->file_size) { + if (io_u->buflen + io_u->offset > f->real_file_size) { if (td->io_ops->flags & FIO_RAWIO) { put_io_u(td, io_u); return NULL; } - io_u->buflen = f->file_size - io_u->offset; + io_u->buflen = f->real_file_size - io_u->offset; } if (io_u->ddir != DDIR_SYNC) { @@ -314,7 +314,7 @@ void io_completed(struct thread_data *td, struct io_u *io_u, if (!io_u->error) { unsigned int bytes = io_u->buflen - io_u->resid; - const int idx = io_u->ddir; + const enum fio_ddir idx = io_u->ddir; td->io_blocks[idx]++; td->io_bytes[idx] += bytes;