If --offset=xx is given, and xx isn't a multiple of the block size,
then align it if we're doing O_DIRECT IO.
Signed-off-by: Jens Axboe <axboe@fb.com>
uint64_t get_start_offset(struct thread_data *td, struct fio_file *f)
{
struct thread_options *o = &td->o;
uint64_t get_start_offset(struct thread_data *td, struct fio_file *f)
{
struct thread_options *o = &td->o;
if (o->file_append && f->filetype == FIO_TYPE_FILE)
return f->real_file_size;
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;