summaryrefslogtreecommitdiff
path: root/utils.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 /utils.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 'utils.c')
-rw-r--r--utils.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/utils.c b/utils.c
index bb4091ec..0f8f91dd 100644
--- a/utils.c
+++ b/utils.c
@@ -2928,7 +2928,7 @@ int btrfs_tree_search2_ioctl_supported(int fd)
return v2_supported;
}
-int btrfs_check_nodesize(u32 nodesize, u32 sectorsize)
+int btrfs_check_nodesize(u32 nodesize, u32 sectorsize, u64 features)
{
if (nodesize < sectorsize) {
fprintf(stderr,
@@ -2945,6 +2945,12 @@ int btrfs_check_nodesize(u32 nodesize, u32 sectorsize)
"ERROR: Illegal nodesize %u (not aligned to %u)\n",
nodesize, sectorsize);
return -1;
+ } else if (features & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS &&
+ nodesize != sectorsize) {
+ fprintf(stderr,
+ "ERROR: Illegal nodesize %u (not equal to %u for mixed block group)\n",
+ nodesize, sectorsize);
+ return -1;
}
return 0;
}