summaryrefslogtreecommitdiff
path: root/mkfs.c
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2015-09-25 18:15:44 +0200
committerDavid Sterba <dsterba@suse.com>2015-10-02 17:54:04 +0200
commitece0e1ea036e6d1c952f304ff74762a12786c37f (patch)
treebba6fb117552bb74b000b84e9de7deb85bde5cc4 /mkfs.c
parent94789777b9e8f350ba815b07baa5383e99cd1944 (diff)
btrfs-progs: utils: Check nodesize against features
Check nodesize against features, not only sectorsize. In fact, one of the btrfs-convert and mkfs differs in the nodesize check. This patch also provides the basis for later btrfs-convert fix. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'mkfs.c')
-rw-r--r--mkfs.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/mkfs.c b/mkfs.c
index 14e7eb40..b8879fcf 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -1466,9 +1466,8 @@ int main(int ac, char **av)
print_usage(c != GETOPT_VAL_HELP);
}
}
+
sectorsize = max(sectorsize, (u32)sysconf(_SC_PAGESIZE));
- if (btrfs_check_nodesize(nodesize, sectorsize))
- exit(1);
saved_optind = optind;
dev_cnt = ac - optind;
if (dev_cnt == 0)
@@ -1542,17 +1541,12 @@ int main(int ac, char **av)
}
}
- if (!nodesize_forced) {
+ if (!nodesize_forced)
nodesize = best_nodesize;
- if (btrfs_check_nodesize(nodesize, sectorsize))
- exit(1);
- }
- if (nodesize != sectorsize) {
- fprintf(stderr, "Error: mixed metadata/data block groups "
- "require metadata blocksizes equal to the sectorsize\n");
- exit(1);
- }
}
+ if (btrfs_check_nodesize(nodesize, sectorsize,
+ features))
+ exit(1);
/* Check device/block_count after the nodesize is determined */
if (block_count && block_count < btrfs_min_dev_size(nodesize)) {