mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-24 23:22:27 +00:00
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>
This commit is contained in:
parent
cfdd42686c
commit
04609add88
1
mkfs.c
1
mkfs.c
@ -1407,6 +1407,7 @@ int main(int ac, char **av)
|
|||||||
close(fd);
|
close(fd);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
dev_block_count = block_count;
|
||||||
ret = btrfs_prepare_device(fd, file, zero_end,
|
ret = btrfs_prepare_device(fd, file, zero_end,
|
||||||
&dev_block_count, &mixed);
|
&dev_block_count, &mixed);
|
||||||
mixed = old_mixed;
|
mixed = old_mixed;
|
||||||
|
2
utils.c
2
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);
|
fprintf(stderr, "unable to find %s size\n", file);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
if (*block_count_ret)
|
||||||
|
block_count = min(block_count, *block_count_ret);
|
||||||
zero_end = 1;
|
zero_end = 1;
|
||||||
|
|
||||||
if (block_count < 1024 * 1024 * 1024 && !(*mixed)) {
|
if (block_count < 1024 * 1024 * 1024 && !(*mixed)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user