When calling the function from `btrfs device zero-super` we don't need
the additional information returned and don't want the "SMALL VOLUME"
warning printed.

Signed-off-by: Hubert Kario <ka...@wit.edu.pl>

diff --git a/utils.c b/utils.c
index ee7fa1b..6773be0 100644
--- a/utils.c
+++ b/utils.c
@@ -557,7 +557,7 @@ int btrfs_prepare_device(int fd, char *file, int zero_end, 
u64 *block_count_ret,
        }
        zero_end = 1;
 
-       if (block_count < 1024 * 1024 * 1024 && !(*mixed)) {
+       if (mixed && block_count < 1024 * 1024 * 1024 && !(*mixed)) {
                printf("SMALL VOLUME: forcing mixed metadata/data groups\n");
                *mixed = 1;
        }
@@ -588,7 +588,9 @@ int btrfs_prepare_device(int fd, char *file, int zero_end, 
u64 *block_count_ret,
                        exit(1);
                }
        }
-       *block_count_ret = block_count;
+
+       if (block_count_ret)
+               *block_count_ret = block_count;
        return 0;
 }
 
-- 
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to