aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2012-03-29 17:02:47 -0400
committerChris Mason <chris.mason@oracle.com>2012-03-29 17:02:47 -0400
commitbc3f116fec194f1d7329b160c266fe16b9266a1e (patch)
tree67f9be8d4527c37c1ad85bdcbc1b6cca7328f49c /fs/btrfs
parente1f041e14cfb322f41f41a308bfede00f1b080cd (diff)
Btrfs: update the checks for mixed block groups with big metadata blocks
Dave Sterba had put in patches to look for mixed data/metadata groups with metadata bigger than 4KB. But these ended up in the wrong place and it wasn't testing the feature flag correctly. This updates the tests to make sure our sizes are matching Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/disk-io.c29
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);