Correctly apply size percentage for file iosize
authorShaohua Li <shli@fusionio.com>
Fri, 21 Sep 2012 06:32:32 +0000 (08:32 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 21 Sep 2012 06:32:32 +0000 (08:32 +0200)
The size percentage should be applied first when calculating file iosize,
otherwise it's a nop.

Signed-off-by: Shaohua Li <shli@fusionio.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
filesetup.c

index 06b7d7fc845cb9f041c03b16f983ffb564443896..9679c88d28245f287d64f13092a72631f7121fca 100644 (file)
@@ -766,8 +766,11 @@ int setup_files(struct thread_data *td)
 
                if (f->io_size == -1ULL)
                        total_size = -1ULL;
 
                if (f->io_size == -1ULL)
                        total_size = -1ULL;
-               else
+               else {
+                        if (td->o.size_percent)
+                                f->io_size = (f->io_size * td->o.size_percent) / 100;
                        total_size += f->io_size;
                        total_size += f->io_size;
+               }
 
                if (f->filetype == FIO_TYPE_FILE &&
                    (f->io_size + f->file_offset) > f->real_file_size &&
 
                if (f->filetype == FIO_TYPE_FILE &&
                    (f->io_size + f->file_offset) > f->real_file_size &&
@@ -781,9 +784,6 @@ int setup_files(struct thread_data *td)
                }
        }
 
                }
        }
 
-       if (td->o.size_percent)
-               total_size = (total_size * td->o.size_percent) / 100;
-
        if (!td->o.size || td->o.size > total_size)
                td->o.size = total_size;
 
        if (!td->o.size || td->o.size > total_size)
                td->o.size = total_size;