diff options
author | David S. Miller <davem@davemloft.net> | 2010-04-11 17:53:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-11 17:53:53 -0400 |
commit | 871039f02f8ec4ab2e5e9010718caa8e085786f1 (patch) | |
tree | f0d2b3127fc48c862967d68c46c2d46668137515 /fs/btrfs/extent-tree.c | |
parent | e4077e018b5ead3de9951fc01d8bf12eeeeeefed (diff) | |
parent | 4a1032faac94ebbf647460ae3e06fc21146eb280 (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/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 1727b26fb194..9e23ffea7f54 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/sort.h> | 22 | #include <linux/sort.h> |
23 | #include <linux/rcupdate.h> | 23 | #include <linux/rcupdate.h> |
24 | #include <linux/kthread.h> | 24 | #include <linux/kthread.h> |
25 | #include <linux/slab.h> | ||
25 | #include "compat.h" | 26 | #include "compat.h" |
26 | #include "hash.h" | 27 | #include "hash.h" |
27 | #include "ctree.h" | 28 | #include "ctree.h" |
@@ -2676,6 +2677,8 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags, | |||
2676 | 2677 | ||
2677 | INIT_LIST_HEAD(&found->block_groups); | 2678 | INIT_LIST_HEAD(&found->block_groups); |
2678 | init_rwsem(&found->groups_sem); | 2679 | init_rwsem(&found->groups_sem); |
2680 | init_waitqueue_head(&found->flush_wait); | ||
2681 | init_waitqueue_head(&found->allocate_wait); | ||
2679 | spin_lock_init(&found->lock); | 2682 | spin_lock_init(&found->lock); |
2680 | found->flags = flags; | 2683 | found->flags = flags; |
2681 | found->total_bytes = total_bytes; | 2684 | found->total_bytes = total_bytes; |
@@ -2846,7 +2849,7 @@ int btrfs_unreserve_metadata_for_delalloc(struct btrfs_root *root, | |||
2846 | } | 2849 | } |
2847 | spin_unlock(&BTRFS_I(inode)->accounting_lock); | 2850 | spin_unlock(&BTRFS_I(inode)->accounting_lock); |
2848 | 2851 | ||
2849 | BTRFS_I(inode)->reserved_extents--; | 2852 | BTRFS_I(inode)->reserved_extents -= num_items; |
2850 | BUG_ON(BTRFS_I(inode)->reserved_extents < 0); | 2853 | BUG_ON(BTRFS_I(inode)->reserved_extents < 0); |
2851 | 2854 | ||
2852 | if (meta_sinfo->bytes_delalloc < num_bytes) { | 2855 | if (meta_sinfo->bytes_delalloc < num_bytes) { |
@@ -2944,12 +2947,10 @@ static void flush_delalloc(struct btrfs_root *root, | |||
2944 | 2947 | ||
2945 | spin_lock(&info->lock); | 2948 | spin_lock(&info->lock); |
2946 | 2949 | ||
2947 | if (!info->flushing) { | 2950 | if (!info->flushing) |
2948 | info->flushing = 1; | 2951 | info->flushing = 1; |
2949 | init_waitqueue_head(&info->flush_wait); | 2952 | else |
2950 | } else { | ||
2951 | wait = true; | 2953 | wait = true; |
2952 | } | ||
2953 | 2954 | ||
2954 | spin_unlock(&info->lock); | 2955 | spin_unlock(&info->lock); |
2955 | 2956 | ||
@@ -3011,7 +3012,6 @@ static int maybe_allocate_chunk(struct btrfs_root *root, | |||
3011 | if (!info->allocating_chunk) { | 3012 | if (!info->allocating_chunk) { |
3012 | info->force_alloc = 1; | 3013 | info->force_alloc = 1; |
3013 | info->allocating_chunk = 1; | 3014 | info->allocating_chunk = 1; |
3014 | init_waitqueue_head(&info->allocate_wait); | ||
3015 | } else { | 3015 | } else { |
3016 | wait = true; | 3016 | wait = true; |
3017 | } | 3017 | } |
@@ -3111,7 +3111,7 @@ again: | |||
3111 | return -ENOSPC; | 3111 | return -ENOSPC; |
3112 | } | 3112 | } |
3113 | 3113 | ||
3114 | BTRFS_I(inode)->reserved_extents++; | 3114 | BTRFS_I(inode)->reserved_extents += num_items; |
3115 | check_force_delalloc(meta_sinfo); | 3115 | check_force_delalloc(meta_sinfo); |
3116 | spin_unlock(&meta_sinfo->lock); | 3116 | spin_unlock(&meta_sinfo->lock); |
3117 | 3117 | ||
@@ -4170,6 +4170,10 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans, | |||
4170 | ins->offset = 0; | 4170 | ins->offset = 0; |
4171 | 4171 | ||
4172 | space_info = __find_space_info(root->fs_info, data); | 4172 | space_info = __find_space_info(root->fs_info, data); |
4173 | if (!space_info) { | ||
4174 | printk(KERN_ERR "No space info for %d\n", data); | ||
4175 | return -ENOSPC; | ||
4176 | } | ||
4173 | 4177 | ||
4174 | if (orig_root->ref_cows || empty_size) | 4178 | if (orig_root->ref_cows || empty_size) |
4175 | allowed_chunk_alloc = 1; | 4179 | allowed_chunk_alloc = 1; |
@@ -5205,6 +5209,8 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans, | |||
5205 | next = btrfs_find_tree_block(root, bytenr, blocksize); | 5209 | next = btrfs_find_tree_block(root, bytenr, blocksize); |
5206 | if (!next) { | 5210 | if (!next) { |
5207 | next = btrfs_find_create_tree_block(root, bytenr, blocksize); | 5211 | next = btrfs_find_create_tree_block(root, bytenr, blocksize); |
5212 | if (!next) | ||
5213 | return -ENOMEM; | ||
5208 | reada = 1; | 5214 | reada = 1; |
5209 | } | 5215 | } |
5210 | btrfs_tree_lock(next); | 5216 | btrfs_tree_lock(next); |
@@ -5417,7 +5423,8 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans, | |||
5417 | if (ret > 0) { | 5423 | if (ret > 0) { |
5418 | path->slots[level]++; | 5424 | path->slots[level]++; |
5419 | continue; | 5425 | continue; |
5420 | } | 5426 | } else if (ret < 0) |
5427 | return ret; | ||
5421 | level = wc->level; | 5428 | level = wc->level; |
5422 | } | 5429 | } |
5423 | return 0; | 5430 | return 0; |
@@ -7369,7 +7376,6 @@ static int find_first_block_group(struct btrfs_root *root, | |||
7369 | } | 7376 | } |
7370 | path->slots[0]++; | 7377 | path->slots[0]++; |
7371 | } | 7378 | } |
7372 | ret = -ENOENT; | ||
7373 | out: | 7379 | out: |
7374 | return ret; | 7380 | return ret; |
7375 | } | 7381 | } |