Fix compile warning on platforms with posix_fallocate
authorJens Axboe <jaxboe@fusionio.com>
Thu, 14 Oct 2010 12:34:05 +0000 (14:34 +0200)
committerJens Axboe <jaxboe@fusionio.com>
Thu, 14 Oct 2010 12:34:05 +0000 (14:34 +0200)
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
smalloc.c

index 4cd8298eaa004d7a56d861aefcb1373ae7fd7001..42008ebfdb6e44732c469b596b7be65786031231 100644 (file)
--- a/smalloc.c
+++ b/smalloc.c
@@ -178,7 +178,7 @@ static int find_next_zero(int word, int start)
 
 static int add_pool(struct pool *pool, unsigned int alloc_size)
 {
-       int fd, bitmap_blocks, ret;
+       int fd, bitmap_blocks;
        char file[] = "/tmp/.fio_smalloc.XXXXXX";
        void *ptr;
 
@@ -203,10 +203,14 @@ static int add_pool(struct pool *pool, unsigned int alloc_size)
        pool->free_blocks = bitmap_blocks * SMALLOC_BPB;
 
 #ifdef FIO_HAVE_FALLOCATE
-       ret = posix_fallocate(fd, 0, alloc_size);
-       if (ret > 0) {
-               fprintf(stderr, "posix_fallocate pool file failed: %s\n", strerror(ret));
-               goto out_unlink;
+       {
+               int ret;
+
+               ret = posix_fallocate(fd, 0, alloc_size);
+               if (ret > 0) {
+                       fprintf(stderr, "posix_fallocate pool file failed: %s\n", strerror(ret));
+                       goto out_unlink;
+               }
        }
 #endif