diff options
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r-- | fs/btrfs/relocation.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index a9728680eca8..e558dd941ded 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/writeback.h> | 21 | #include <linux/writeback.h> |
22 | #include <linux/blkdev.h> | 22 | #include <linux/blkdev.h> |
23 | #include <linux/rbtree.h> | 23 | #include <linux/rbtree.h> |
24 | #include <linux/slab.h> | ||
24 | #include "ctree.h" | 25 | #include "ctree.h" |
25 | #include "disk-io.h" | 26 | #include "disk-io.h" |
26 | #include "transaction.h" | 27 | #include "transaction.h" |
@@ -170,14 +171,14 @@ struct async_merge { | |||
170 | 171 | ||
171 | static void mapping_tree_init(struct mapping_tree *tree) | 172 | static void mapping_tree_init(struct mapping_tree *tree) |
172 | { | 173 | { |
173 | tree->rb_root.rb_node = NULL; | 174 | tree->rb_root = RB_ROOT; |
174 | spin_lock_init(&tree->lock); | 175 | spin_lock_init(&tree->lock); |
175 | } | 176 | } |
176 | 177 | ||
177 | static void backref_cache_init(struct backref_cache *cache) | 178 | static void backref_cache_init(struct backref_cache *cache) |
178 | { | 179 | { |
179 | int i; | 180 | int i; |
180 | cache->rb_root.rb_node = NULL; | 181 | cache->rb_root = RB_ROOT; |
181 | for (i = 0; i < BTRFS_MAX_LEVEL; i++) | 182 | for (i = 0; i < BTRFS_MAX_LEVEL; i++) |
182 | INIT_LIST_HEAD(&cache->pending[i]); | 183 | INIT_LIST_HEAD(&cache->pending[i]); |
183 | spin_lock_init(&cache->lock); | 184 | spin_lock_init(&cache->lock); |
@@ -2659,7 +2660,7 @@ static int relocate_file_extent_cluster(struct inode *inode, | |||
2659 | EXTENT_BOUNDARY, GFP_NOFS); | 2660 | EXTENT_BOUNDARY, GFP_NOFS); |
2660 | nr++; | 2661 | nr++; |
2661 | } | 2662 | } |
2662 | btrfs_set_extent_delalloc(inode, page_start, page_end); | 2663 | btrfs_set_extent_delalloc(inode, page_start, page_end, NULL); |
2663 | 2664 | ||
2664 | set_page_dirty(page); | 2665 | set_page_dirty(page); |
2665 | dirty_page++; | 2666 | dirty_page++; |
@@ -3281,8 +3282,10 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) | |||
3281 | return -ENOMEM; | 3282 | return -ENOMEM; |
3282 | 3283 | ||
3283 | path = btrfs_alloc_path(); | 3284 | path = btrfs_alloc_path(); |
3284 | if (!path) | 3285 | if (!path) { |
3286 | kfree(cluster); | ||
3285 | return -ENOMEM; | 3287 | return -ENOMEM; |
3288 | } | ||
3286 | 3289 | ||
3287 | rc->extents_found = 0; | 3290 | rc->extents_found = 0; |
3288 | rc->extents_skipped = 0; | 3291 | rc->extents_skipped = 0; |
@@ -3485,7 +3488,7 @@ static struct inode *create_reloc_inode(struct btrfs_fs_info *fs_info, | |||
3485 | key.objectid = objectid; | 3488 | key.objectid = objectid; |
3486 | key.type = BTRFS_INODE_ITEM_KEY; | 3489 | key.type = BTRFS_INODE_ITEM_KEY; |
3487 | key.offset = 0; | 3490 | key.offset = 0; |
3488 | inode = btrfs_iget(root->fs_info->sb, &key, root); | 3491 | inode = btrfs_iget(root->fs_info->sb, &key, root, NULL); |
3489 | BUG_ON(IS_ERR(inode) || is_bad_inode(inode)); | 3492 | BUG_ON(IS_ERR(inode) || is_bad_inode(inode)); |
3490 | BTRFS_I(inode)->index_cnt = group->key.objectid; | 3493 | BTRFS_I(inode)->index_cnt = group->key.objectid; |
3491 | 3494 | ||
@@ -3762,7 +3765,8 @@ out: | |||
3762 | BTRFS_DATA_RELOC_TREE_OBJECTID); | 3765 | BTRFS_DATA_RELOC_TREE_OBJECTID); |
3763 | if (IS_ERR(fs_root)) | 3766 | if (IS_ERR(fs_root)) |
3764 | err = PTR_ERR(fs_root); | 3767 | err = PTR_ERR(fs_root); |
3765 | btrfs_orphan_cleanup(fs_root); | 3768 | else |
3769 | btrfs_orphan_cleanup(fs_root); | ||
3766 | } | 3770 | } |
3767 | return err; | 3771 | return err; |
3768 | } | 3772 | } |