filesetup: align a size given as a percentage to the block size
authorJens Axboe <axboe@fb.com>
Wed, 18 May 2016 21:06:05 +0000 (15:06 -0600)
committerJens Axboe <axboe@fb.com>
Wed, 18 May 2016 21:06:05 +0000 (15:06 -0600)
We want it to be a nice multiple of (at least) our minimum block
size.

Signed-off-by: Jens Axboe <axboe@fb.com>
filesetup.c

index 9c37ae57e24af13cc411a8f3f8398e06f5963626..f721c36abbb045ca7b4e4a618c64b0199d5148e3 100644 (file)
@@ -894,8 +894,10 @@ int setup_files(struct thread_data *td)
                if (f->io_size == -1ULL)
                        total_size = -1ULL;
                else {
                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;
                }
 
                        total_size += f->io_size;
                }