aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-05-08 07:39:59 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-05-08 07:39:59 -0400
commit5e13a0c5ec05d382b488a691dfb8af015b1dea1e (patch)
tree7a06dfa1f7661f8908193f2437b32452520221d3 /fs/btrfs/volumes.c
parentb615b57a124a4af7b68196bc2fb8acc236041fa2 (diff)
parent4f256e8aa3eda15c11c3cec3ec5336e1fc579cbd (diff)
Merge remote-tracking branch 'airlied/drm-core-next' into drm-intel-next-queued
Backmerge of drm-next to resolve a few ugly conflicts and to get a few fixes from 3.4-rc6 (which drm-next has already merged). Note that this merge also restricts the stencil cache lra evict policy workaround to snb (as it should) - I had to frob the code anyway because the CM0_MASK_SHIFT define died in the masked bit cleanups. We need the backmerge to get Paulo Zanoni's infoframe regression fix for gm45 - further bugfixes from him touch the same area and would needlessly conflict. Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 759d02486d7c..1411b99555a4 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3324,12 +3324,14 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
3324 stripe_size = devices_info[ndevs-1].max_avail; 3324 stripe_size = devices_info[ndevs-1].max_avail;
3325 num_stripes = ndevs * dev_stripes; 3325 num_stripes = ndevs * dev_stripes;
3326 3326
3327 if (stripe_size * num_stripes > max_chunk_size * ncopies) { 3327 if (stripe_size * ndevs > max_chunk_size * ncopies) {
3328 stripe_size = max_chunk_size * ncopies; 3328 stripe_size = max_chunk_size * ncopies;
3329 do_div(stripe_size, num_stripes); 3329 do_div(stripe_size, ndevs);
3330 } 3330 }
3331 3331
3332 do_div(stripe_size, dev_stripes); 3332 do_div(stripe_size, dev_stripes);
3333
3334 /* align to BTRFS_STRIPE_LEN */
3333 do_div(stripe_size, BTRFS_STRIPE_LEN); 3335 do_div(stripe_size, BTRFS_STRIPE_LEN);
3334 stripe_size *= BTRFS_STRIPE_LEN; 3336 stripe_size *= BTRFS_STRIPE_LEN;
3335 3337
@@ -3805,10 +3807,11 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw,
3805 else if (mirror_num) 3807 else if (mirror_num)
3806 stripe_index += mirror_num - 1; 3808 stripe_index += mirror_num - 1;
3807 else { 3809 else {
3810 int old_stripe_index = stripe_index;
3808 stripe_index = find_live_mirror(map, stripe_index, 3811 stripe_index = find_live_mirror(map, stripe_index,
3809 map->sub_stripes, stripe_index + 3812 map->sub_stripes, stripe_index +
3810 current->pid % map->sub_stripes); 3813 current->pid % map->sub_stripes);
3811 mirror_num = stripe_index + 1; 3814 mirror_num = stripe_index - old_stripe_index + 1;
3812 } 3815 }
3813 } else { 3816 } else {
3814 /* 3817 /*
@@ -4350,8 +4353,10 @@ static int open_seed_devices(struct btrfs_root *root, u8 *fsid)
4350 4353
4351 ret = __btrfs_open_devices(fs_devices, FMODE_READ, 4354 ret = __btrfs_open_devices(fs_devices, FMODE_READ,
4352 root->fs_info->bdev_holder); 4355 root->fs_info->bdev_holder);
4353 if (ret) 4356 if (ret) {
4357 free_fs_devices(fs_devices);
4354 goto out; 4358 goto out;
4359 }
4355 4360
4356 if (!fs_devices->seeding) { 4361 if (!fs_devices->seeding) {
4357 __btrfs_close_devices(fs_devices); 4362 __btrfs_close_devices(fs_devices);