summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mkfs.c1
-rw-r--r--utils.c2
2 files changed, 3 insertions, 0 deletions
diff --git a/mkfs.c b/mkfs.c
index aa508198..99fd7d4b 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -1407,6 +1407,7 @@ int main(int ac, char **av)
close(fd);
continue;
}
+ dev_block_count = block_count;
ret = btrfs_prepare_device(fd, file, zero_end,
&dev_block_count, &mixed);
mixed = old_mixed;
diff --git a/utils.c b/utils.c
index 492c439d..58330308 100644
--- a/utils.c
+++ b/utils.c
@@ -555,6 +555,8 @@ int btrfs_prepare_device(int fd, char *file, int zero_end, u64 *block_count_ret,
fprintf(stderr, "unable to find %s size\n", file);
exit(1);
}
+ if (*block_count_ret)
+ block_count = min(block_count, *block_count_ret);
zero_end = 1;
if (block_count < 1024 * 1024 * 1024 && !(*mixed)) {