filesetup: fix a bug where we overwrite the set size
authorJens Axboe <axboe@fb.com>
Tue, 30 Sep 2014 03:23:51 +0000 (21:23 -0600)
committerJens Axboe <axboe@fb.com>
Tue, 30 Sep 2014 03:23:51 +0000 (21:23 -0600)
For the null io engine, we don't set file sizes. And we should
not overwrite a potentially legitimate o->size, if total_size
is zero.

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

index 29a76c0c3f5a52d60d18cb9775ec8b99bc603a1a..43146ba7671f61216fa938380c4bab908cd44b20 100644 (file)
@@ -898,7 +898,7 @@ int setup_files(struct thread_data *td)
                }
        }
 
-       if (!o->size || o->size > total_size)
+       if (!o->size || (total_size && o->size > total_size))
                o->size = total_size;
 
        if (o->size < td_min_bs(td)) {