From: Jens Axboe Date: Wed, 20 Dec 2006 09:58:07 +0000 (+0100) Subject: [PATCH] Must use ->real_file_size X-Git-Tag: fio-1.10~9 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=ee88470c001012d08ae37bfc31741a935be2e7a1;ds=inline [PATCH] Must use ->real_file_size ->file_size is the size of the file from offset, while ->real_file_size is the total size of the file. So when comparing EOF, we should look at ->real_file_size against the offset. Signed-off-by: Jens Axboe --- diff --git a/filesetup.c b/filesetup.c index cc89b7e6..a14cd950 100644 --- a/filesetup.c +++ b/filesetup.c @@ -156,7 +156,7 @@ static int file_size(struct thread_data *td, struct fio_file *f) f->file_size = f->real_file_size; } - f->file_size -= f->file_offset; + f->file_size = f->real_file_size - f->file_offset; return 0; } diff --git a/io_u.c b/io_u.c index 558b0b07..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; @@ -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) {