fileset: fix double addition of file offset
authorJens Axboe <axboe@kernel.dk>
Wed, 7 Jun 2017 14:48:05 +0000 (08:48 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 7 Jun 2017 14:48:05 +0000 (08:48 -0600)
The offset-as-percentage patch inadvertently screwed up the regular
offset path, fix that up.

Fixes: 89978a6b26f8 ("allow a percent value for the offset parameter")
Fixes: https://github.com/axboe/fio/issues/382
Signed-off-by: Jens Axboe <axboe@kernel.dk>
filesetup.c

index e548d21daab1dac780940c0ef554b633d67258ff..683a5c55c12f4347fea4d10f90de49e6c4cd1dc1 100644 (file)
@@ -840,7 +840,6 @@ uint64_t get_start_offset(struct thread_data *td, struct fio_file *f)
                return f->real_file_size;
 
        if (o->start_offset_percent > 0) {
                return f->real_file_size;
 
        if (o->start_offset_percent > 0) {
-
                /* if blockalign is provided, find the min across read, write, and trim */
                if (fio_option_is_set(o, ba)) {
                        align_bs = (unsigned long long) min(o->ba[DDIR_READ], o->ba[DDIR_WRITE]);
                /* if blockalign is provided, find the min across read, write, and trim */
                if (fio_option_is_set(o, ba)) {
                        align_bs = (unsigned long long) min(o->ba[DDIR_READ], o->ba[DDIR_WRITE]);
@@ -858,8 +857,8 @@ uint64_t get_start_offset(struct thread_data *td, struct fio_file *f)
                offset = (offset / align_bs + (offset % align_bs != 0)) * align_bs;
 
        } else {  /* start_offset_percent not set */
                offset = (offset / align_bs + (offset % align_bs != 0)) * align_bs;
 
        } else {  /* start_offset_percent not set */
-               offset = o->start_offset + o->start_offset +
-                       td->subjob_number * o->offset_increment;
+               offset = o->start_offset +
+                               td->subjob_number * o->offset_increment;
        }
        return offset;
 }
        }
        return offset;
 }