aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-04-05 16:21:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-04-05 16:21:15 -0400
commit795d580baec0d5386b83a8b557df47c20810e86b (patch)
treed0387c37562e9e27a4f43cf7ae425319cbdad359 /fs/btrfs/volumes.c
parent449cedf099b23a250e7d61982e35555ccb871182 (diff)
parent109f6aef5fc436f355ad027f4d97bd696df2049a (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
* git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable: Btrfs: add check for changed leaves in setup_leaf_for_split Btrfs: create snapshot references in same commit as snapshot Btrfs: fix small race with delalloc flushing waitqueue's Btrfs: use add_to_page_cache_lru, use __page_cache_alloc Btrfs: fix chunk allocate size calculation Btrfs: kill max_extent mount option Btrfs: fail to mount if we have problems reading the block groups Btrfs: check btrfs_get_extent return for IS_ERR() Btrfs: handle kmalloc() failure in inode lookup ioctl Btrfs: dereferencing freed memory Btrfs: Simplify num_stripes's calculation logical for __btrfs_alloc_chunk() Btrfs: Add error handle for btrfs_search_slot() in btrfs_read_chunk_tree() Btrfs: Remove unnecessary finish_wait() in wait_current_trans() Btrfs: add NULL check for do_walk_down() Btrfs: remove duplicate include in ioctl.c Fix trivial conflict in fs/btrfs/compression.c due to slab.h include cleanups.
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];