summaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2012-03-28 14:20:52 -0400
committerChris Mason <chris.mason@fusionio.com>2012-07-03 16:27:46 -0400
commit04609add88ef8428d725de6ef60f46a3ff0dbc8e (patch)
tree9ae42b5151a14e775a6f7036d384abb18a556d03 /utils.c
parentcfdd42686c7534cd54270aa382f8a28c61bf2c70 (diff)
btrfs-progs: enforce block count on all devices in mkfs
I had a test that creates a 7gig raid1 device but it was ending up wonky because the second device that gets added is the full size of the disk instead of the limited size. So enforce the limited size on all disks passed in at mkfs time, otherwise our threshold calculations end up wonky when doing chunk allocations. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c2
1 files changed, 2 insertions, 0 deletions
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)) {