aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-04-11 17:53:53 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-11 17:53:53 -0400
commit871039f02f8ec4ab2e5e9010718caa8e085786f1 (patch)
treef0d2b3127fc48c862967d68c46c2d46668137515 /fs/btrfs/volumes.c
parente4077e018b5ead3de9951fc01d8bf12eeeeeefed (diff)
parent4a1032faac94ebbf647460ae3e06fc21146eb280 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/stmmac/stmmac_main.c drivers/net/wireless/wl12xx/wl1271_cmd.c drivers/net/wireless/wl12xx/wl1271_main.c drivers/net/wireless/wl12xx/wl1271_spi.c net/core/ethtool.c net/mac80211/scan.c
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 9df8e3f1ccab..aa7dc36dac78 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -17,6 +17,7 @@
17 */ 17 */
18#include <linux/sched.h> 18#include <linux/sched.h>
19#include <linux/bio.h> 19#include <linux/bio.h>
20#include <linux/slab.h>
20#include <linux/buffer_head.h> 21#include <linux/buffer_head.h>
21#include <linux/blkdev.h> 22#include <linux/blkdev.h>
22#include <linux/random.h> 23#include <linux/random.h>
@@ -2198,9 +2199,9 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
2198 min_stripes = 2; 2199 min_stripes = 2;
2199 } 2200 }
2200 if (type & (BTRFS_BLOCK_GROUP_RAID1)) { 2201 if (type & (BTRFS_BLOCK_GROUP_RAID1)) {
2201 num_stripes = min_t(u64, 2, fs_devices->rw_devices); 2202 if (fs_devices->rw_devices < 2)
2202 if (num_stripes < 2)
2203 return -ENOSPC; 2203 return -ENOSPC;
2204 num_stripes = 2;
2204 min_stripes = 2; 2205 min_stripes = 2;
2205 } 2206 }
2206 if (type & (BTRFS_BLOCK_GROUP_RAID10)) { 2207 if (type & (BTRFS_BLOCK_GROUP_RAID10)) {
@@ -2244,8 +2245,10 @@ again:
2244 do_div(calc_size, stripe_len); 2245 do_div(calc_size, stripe_len);
2245 calc_size *= stripe_len; 2246 calc_size *= stripe_len;
2246 } 2247 }
2248
2247 /* we don't want tiny stripes */ 2249 /* we don't want tiny stripes */
2248 calc_size = max_t(u64, min_stripe_size, calc_size); 2250 if (!looped)
2251 calc_size = max_t(u64, min_stripe_size, calc_size);
2249 2252
2250 do_div(calc_size, stripe_len); 2253 do_div(calc_size, stripe_len);
2251 calc_size *= stripe_len; 2254 calc_size *= stripe_len;
@@ -3389,6 +3392,8 @@ int btrfs_read_chunk_tree(struct btrfs_root *root)
3389 key.type = 0; 3392 key.type = 0;
3390again: 3393again:
3391 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;
3392 while (1) { 3397 while (1) {
3393 leaf = path->nodes[0]; 3398 leaf = path->nodes[0];
3394 slot = path->slots[0]; 3399 slot = path->slots[0];