diff options
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index fd43f6b2f438..20196f411206 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -2120,6 +2120,23 @@ int open_ctree(struct super_block *sb, | |||
2120 | features |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA; | 2120 | features |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA; |
2121 | } | 2121 | } |
2122 | 2122 | ||
2123 | nodesize = btrfs_super_nodesize(disk_super); | ||
2124 | leafsize = btrfs_super_leafsize(disk_super); | ||
2125 | sectorsize = btrfs_super_sectorsize(disk_super); | ||
2126 | stripesize = btrfs_super_stripesize(disk_super); | ||
2127 | |||
2128 | /* | ||
2129 | * mixed block groups end up with duplicate but slightly offset | ||
2130 | * extent buffers for the same range. It leads to corruptions | ||
2131 | */ | ||
2132 | if ((features & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) && | ||
2133 | (sectorsize != leafsize)) { | ||
2134 | printk(KERN_WARNING "btrfs: unequal leaf/node/sector sizes " | ||
2135 | "are not allowed for mixed block groups on %s\n", | ||
2136 | sb->s_id); | ||
2137 | goto fail_alloc; | ||
2138 | } | ||
2139 | |||
2123 | btrfs_set_super_incompat_flags(disk_super, features); | 2140 | btrfs_set_super_incompat_flags(disk_super, features); |
2124 | 2141 | ||
2125 | features = btrfs_super_compat_ro_flags(disk_super) & | 2142 | features = btrfs_super_compat_ro_flags(disk_super) & |
@@ -2223,10 +2240,6 @@ int open_ctree(struct super_block *sb, | |||
2223 | fs_info->bdi.ra_pages = max(fs_info->bdi.ra_pages, | 2240 | fs_info->bdi.ra_pages = max(fs_info->bdi.ra_pages, |
2224 | 4 * 1024 * 1024 / PAGE_CACHE_SIZE); | 2241 | 4 * 1024 * 1024 / PAGE_CACHE_SIZE); |
2225 | 2242 | ||
2226 | nodesize = btrfs_super_nodesize(disk_super); | ||
2227 | leafsize = btrfs_super_leafsize(disk_super); | ||
2228 | sectorsize = btrfs_super_sectorsize(disk_super); | ||
2229 | stripesize = btrfs_super_stripesize(disk_super); | ||
2230 | tree_root->nodesize = nodesize; | 2243 | tree_root->nodesize = nodesize; |
2231 | tree_root->leafsize = leafsize; | 2244 | tree_root->leafsize = leafsize; |
2232 | tree_root->sectorsize = sectorsize; | 2245 | tree_root->sectorsize = sectorsize; |
@@ -2247,14 +2260,6 @@ int open_ctree(struct super_block *sb, | |||
2247 | goto fail_sb_buffer; | 2260 | goto fail_sb_buffer; |
2248 | } | 2261 | } |
2249 | 2262 | ||
2250 | if ((features & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) && | ||
2251 | (leafsize != nodesize || sectorsize != nodesize)) { | ||
2252 | printk(KERN_WARNING "btrfs: unequal leaf/node/sector sizes " | ||
2253 | "are not allowed for mixed block groups on %s\n", | ||
2254 | sb->s_id); | ||
2255 | goto fail_sb_buffer; | ||
2256 | } | ||
2257 | |||
2258 | mutex_lock(&fs_info->chunk_mutex); | 2263 | mutex_lock(&fs_info->chunk_mutex); |
2259 | ret = btrfs_read_sys_array(tree_root); | 2264 | ret = btrfs_read_sys_array(tree_root); |
2260 | mutex_unlock(&fs_info->chunk_mutex); | 2265 | mutex_unlock(&fs_info->chunk_mutex); |