aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/free-space-cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/free-space-cache.c')
-rw-r--r--fs/btrfs/free-space-cache.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 25a13ab750f8..70d45795d758 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -53,7 +53,7 @@ static struct inode *__lookup_free_space_inode(struct btrfs_root *root,
53 if (ret < 0) 53 if (ret < 0)
54 return ERR_PTR(ret); 54 return ERR_PTR(ret);
55 if (ret > 0) { 55 if (ret > 0) {
56 btrfs_release_path(root, path); 56 btrfs_release_path(path);
57 return ERR_PTR(-ENOENT); 57 return ERR_PTR(-ENOENT);
58 } 58 }
59 59
@@ -62,7 +62,7 @@ static struct inode *__lookup_free_space_inode(struct btrfs_root *root,
62 struct btrfs_free_space_header); 62 struct btrfs_free_space_header);
63 btrfs_free_space_key(leaf, header, &disk_key); 63 btrfs_free_space_key(leaf, header, &disk_key);
64 btrfs_disk_key_to_cpu(&location, &disk_key); 64 btrfs_disk_key_to_cpu(&location, &disk_key);
65 btrfs_release_path(root, path); 65 btrfs_release_path(path);
66 66
67 inode = btrfs_iget(root->fs_info->sb, &location, root, NULL); 67 inode = btrfs_iget(root->fs_info->sb, &location, root, NULL);
68 if (!inode) 68 if (!inode)
@@ -140,7 +140,7 @@ int __create_free_space_inode(struct btrfs_root *root,
140 btrfs_set_inode_transid(leaf, inode_item, trans->transid); 140 btrfs_set_inode_transid(leaf, inode_item, trans->transid);
141 btrfs_set_inode_block_group(leaf, inode_item, offset); 141 btrfs_set_inode_block_group(leaf, inode_item, offset);
142 btrfs_mark_buffer_dirty(leaf); 142 btrfs_mark_buffer_dirty(leaf);
143 btrfs_release_path(root, path); 143 btrfs_release_path(path);
144 144
145 key.objectid = BTRFS_FREE_SPACE_OBJECTID; 145 key.objectid = BTRFS_FREE_SPACE_OBJECTID;
146 key.offset = offset; 146 key.offset = offset;
@@ -149,7 +149,7 @@ int __create_free_space_inode(struct btrfs_root *root,
149 ret = btrfs_insert_empty_item(trans, root, path, &key, 149 ret = btrfs_insert_empty_item(trans, root, path, &key,
150 sizeof(struct btrfs_free_space_header)); 150 sizeof(struct btrfs_free_space_header));
151 if (ret < 0) { 151 if (ret < 0) {
152 btrfs_release_path(root, path); 152 btrfs_release_path(path);
153 return ret; 153 return ret;
154 } 154 }
155 leaf = path->nodes[0]; 155 leaf = path->nodes[0];
@@ -158,7 +158,7 @@ int __create_free_space_inode(struct btrfs_root *root,
158 memset_extent_buffer(leaf, 0, (unsigned long)header, sizeof(*header)); 158 memset_extent_buffer(leaf, 0, (unsigned long)header, sizeof(*header));
159 btrfs_set_free_space_key(leaf, header, &disk_key); 159 btrfs_set_free_space_key(leaf, header, &disk_key);
160 btrfs_mark_buffer_dirty(leaf); 160 btrfs_mark_buffer_dirty(leaf);
161 btrfs_release_path(root, path); 161 btrfs_release_path(path);
162 162
163 return 0; 163 return 0;
164} 164}
@@ -266,7 +266,7 @@ int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
266 if (ret < 0) 266 if (ret < 0)
267 goto out; 267 goto out;
268 else if (ret > 0) { 268 else if (ret > 0) {
269 btrfs_release_path(root, path); 269 btrfs_release_path(path);
270 ret = 0; 270 ret = 0;
271 goto out; 271 goto out;
272 } 272 }
@@ -279,7 +279,7 @@ int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
279 num_entries = btrfs_free_space_entries(leaf, header); 279 num_entries = btrfs_free_space_entries(leaf, header);
280 num_bitmaps = btrfs_free_space_bitmaps(leaf, header); 280 num_bitmaps = btrfs_free_space_bitmaps(leaf, header);
281 generation = btrfs_free_space_generation(leaf, header); 281 generation = btrfs_free_space_generation(leaf, header);
282 btrfs_release_path(root, path); 282 btrfs_release_path(path);
283 283
284 if (BTRFS_I(inode)->generation != generation) { 284 if (BTRFS_I(inode)->generation != generation) {
285 printk(KERN_ERR "btrfs: free space inode generation (%llu) did" 285 printk(KERN_ERR "btrfs: free space inode generation (%llu) did"
@@ -842,7 +842,7 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
842 EXTENT_DIRTY | EXTENT_DELALLOC | 842 EXTENT_DIRTY | EXTENT_DELALLOC |
843 EXTENT_DO_ACCOUNTING, 0, 0, NULL, 843 EXTENT_DO_ACCOUNTING, 0, 0, NULL,
844 GFP_NOFS); 844 GFP_NOFS);
845 btrfs_release_path(root, path); 845 btrfs_release_path(path);
846 goto out_free; 846 goto out_free;
847 } 847 }
848 } 848 }
@@ -852,7 +852,7 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
852 btrfs_set_free_space_bitmaps(leaf, header, bitmaps); 852 btrfs_set_free_space_bitmaps(leaf, header, bitmaps);
853 btrfs_set_free_space_generation(leaf, header, trans->transid); 853 btrfs_set_free_space_generation(leaf, header, trans->transid);
854 btrfs_mark_buffer_dirty(leaf); 854 btrfs_mark_buffer_dirty(leaf);
855 btrfs_release_path(root, path); 855 btrfs_release_path(path);
856 856
857 ret = 1; 857 ret = 1;
858 858
@@ -1504,7 +1504,7 @@ out:
1504 return ret; 1504 return ret;
1505} 1505}
1506 1506
1507bool try_merge_free_space(struct btrfs_free_space_ctl *ctl, 1507static bool try_merge_free_space(struct btrfs_free_space_ctl *ctl,
1508 struct btrfs_free_space *info, bool update_stat) 1508 struct btrfs_free_space *info, bool update_stat)
1509{ 1509{
1510 struct btrfs_free_space *left_info; 1510 struct btrfs_free_space *left_info;
@@ -1984,8 +1984,6 @@ u64 btrfs_alloc_from_cluster(struct btrfs_block_group_cache *block_group,
1984 while(1) { 1984 while(1) {
1985 if (entry->bytes < bytes || 1985 if (entry->bytes < bytes ||
1986 (!entry->bitmap && entry->offset < min_start)) { 1986 (!entry->bitmap && entry->offset < min_start)) {
1987 struct rb_node *node;
1988
1989 node = rb_next(&entry->offset_index); 1987 node = rb_next(&entry->offset_index);
1990 if (!node) 1988 if (!node)
1991 break; 1989 break;
@@ -1999,7 +1997,6 @@ u64 btrfs_alloc_from_cluster(struct btrfs_block_group_cache *block_group,
1999 cluster, entry, bytes, 1997 cluster, entry, bytes,
2000 min_start); 1998 min_start);
2001 if (ret == 0) { 1999 if (ret == 0) {
2002 struct rb_node *node;
2003 node = rb_next(&entry->offset_index); 2000 node = rb_next(&entry->offset_index);
2004 if (!node) 2001 if (!node)
2005 break; 2002 break;