aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 1692ec9cd7b0..aa7dc36dac78 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2199,9 +2199,9 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
2199 min_stripes = 2; 2199 min_stripes = 2;
2200 } 2200 }
2201 if (type & (BTRFS_BLOCK_GROUP_RAID1)) { 2201 if (type & (BTRFS_BLOCK_GROUP_RAID1)) {
2202 num_stripes = min_t(u64, 2, fs_devices->rw_devices); 2202 if (fs_devices->rw_devices < 2)
2203 if (num_stripes < 2)
2204 return -ENOSPC; 2203 return -ENOSPC;
2204 num_stripes = 2;
2205 min_stripes = 2; 2205 min_stripes = 2;
2206 } 2206 }
2207 if (type & (BTRFS_BLOCK_GROUP_RAID10)) { 2207 if (type & (BTRFS_BLOCK_GROUP_RAID10)) {
@@ -2245,8 +2245,10 @@ again:
2245 do_div(calc_size, stripe_len); 2245 do_div(calc_size, stripe_len);
2246 calc_size *= stripe_len; 2246 calc_size *= stripe_len;
2247 } 2247 }
2248
2248 /* we don't want tiny stripes */ 2249 /* we don't want tiny stripes */
2249 calc_size = max_t(u64, min_stripe_size, calc_size); 2250 if (!looped)
2251 calc_size = max_t(u64, min_stripe_size, calc_size);
2250 2252
2251 do_div(calc_size, stripe_len); 2253 do_div(calc_size, stripe_len);
2252 calc_size *= stripe_len; 2254 calc_size *= stripe_len;
@@ -3390,6 +3392,8 @@ int btrfs_read_chunk_tree(struct btrfs_root *root)
3390 key.type = 0; 3392 key.type = 0;
3391again: 3393again:
3392 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); 3394 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
3395 if (ret < 0)
3396 goto error;
3393 while (1) { 3397 while (1) {
3394 leaf = path->nodes[0]; 3398 leaf = path->nodes[0];
3395 slot = path->slots[0]; 3399 slot = path->slots[0];