X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=filesetup.c;h=f721c36abbb045ca7b4e4a618c64b0199d5148e3;hb=2c45a4acc6a5e335b9dcf4d6722d4cbbf92d9f6c;hp=a82163255690027f94baa487112458746c1256be;hpb=a3f001f5f679ae4efc5f34f682b16a2673ec2bac;p=fio.git diff --git a/filesetup.c b/filesetup.c index a8216325..f721c36a 100644 --- a/filesetup.c +++ b/filesetup.c @@ -761,12 +761,16 @@ static unsigned long long get_fs_free_counts(struct thread_data *td) uint64_t get_start_offset(struct thread_data *td, struct fio_file *f) { struct thread_options *o = &td->o; + uint64_t offset; if (o->file_append && f->filetype == FIO_TYPE_FILE) return f->real_file_size; - return td->o.start_offset + - td->subjob_number * td->o.offset_increment; + offset = td->o.start_offset + td->subjob_number * td->o.offset_increment; + if (offset % td_max_bs(td)) + offset -= (offset % td_max_bs(td)); + + return offset; } /* @@ -809,6 +813,7 @@ int setup_files(struct thread_data *td) */ total_size = 0; for_each_file(td, f, i) { + f->fileno = i; if (f->real_file_size == -1ULL) total_size = -1ULL; else @@ -889,8 +894,10 @@ int setup_files(struct thread_data *td) if (f->io_size == -1ULL) total_size = -1ULL; else { - if (o->size_percent) - f->io_size = (f->io_size * o->size_percent) / 100; + if (o->size_percent) { + f->io_size = (f->io_size * o->size_percent) / 100; + f->io_size -= (f->io_size % td_min_bs(td)); + } total_size += f->io_size; }