@@ -1345,7 +1345,12 @@ int main(int ac, char **av)
&dev_block_count, &mixed, nodiscard);
if (block_count == 0)
block_count = dev_block_count;
- else if (block_count > dev_block_count) {
+ else if (block_count < BTRFS_MKFS_SYSTEM_MAX_SIZE) {
+ fprintf(stderr, "Illegal total number of bytes %u "
+ "(smaller than %u)\n",
+ block_count, BTRFS_MKFS_SYSTEM_MAX_SIZE);
+ exit(1);
+ } else if (block_count > dev_block_count) {
fprintf(stderr, "%s is smaller than requested size\n", file);
exit(1);
}
@@ -20,6 +20,7 @@
#define __UTILS__
#define BTRFS_MKFS_SYSTEM_GROUP_SIZE (4 * 1024 * 1024)
+#define BTRFS_MKFS_SYSTEM_MAX_SIZE (156 * 1024 * 1024)
int make_btrfs(int fd, const char *device, const char *label,
u64 blocks[6], u64 num_bytes, u32 nodesize,