Commit b3b4aa74 authored by David Sterba's avatar David Sterba

btrfs: drop unused parameter from btrfs_release_path

parameter tree root it's not used since commit
5f39d397 ("Btrfs: Create extent_buffer
interface for large blocksizes")
Signed-off-by: default avatarDavid Sterba <dsterba@suse.cz>
parent ba144192
...@@ -107,7 +107,7 @@ void btrfs_free_path(struct btrfs_path *p) ...@@ -107,7 +107,7 @@ void btrfs_free_path(struct btrfs_path *p)
{ {
if (!p) if (!p)
return; return;
btrfs_release_path(NULL, p); btrfs_release_path(p);
kmem_cache_free(btrfs_path_cachep, p); kmem_cache_free(btrfs_path_cachep, p);
} }
...@@ -117,7 +117,7 @@ void btrfs_free_path(struct btrfs_path *p) ...@@ -117,7 +117,7 @@ void btrfs_free_path(struct btrfs_path *p)
* *
* It is safe to call this on paths that no locks or extent buffers held. * It is safe to call this on paths that no locks or extent buffers held.
*/ */
noinline void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p) noinline void btrfs_release_path(struct btrfs_path *p)
{ {
int i; int i;
...@@ -1328,7 +1328,7 @@ static noinline int reada_for_balance(struct btrfs_root *root, ...@@ -1328,7 +1328,7 @@ static noinline int reada_for_balance(struct btrfs_root *root,
ret = -EAGAIN; ret = -EAGAIN;
/* release the whole path */ /* release the whole path */
btrfs_release_path(root, path); btrfs_release_path(path);
/* read the blocks */ /* read the blocks */
if (block1) if (block1)
...@@ -1475,7 +1475,7 @@ read_block_for_search(struct btrfs_trans_handle *trans, ...@@ -1475,7 +1475,7 @@ read_block_for_search(struct btrfs_trans_handle *trans,
return 0; return 0;
} }
free_extent_buffer(tmp); free_extent_buffer(tmp);
btrfs_release_path(NULL, p); btrfs_release_path(p);
return -EIO; return -EIO;
} }
} }
...@@ -1494,7 +1494,7 @@ read_block_for_search(struct btrfs_trans_handle *trans, ...@@ -1494,7 +1494,7 @@ read_block_for_search(struct btrfs_trans_handle *trans,
if (p->reada) if (p->reada)
reada_for_search(root, p, level, slot, key->objectid); reada_for_search(root, p, level, slot, key->objectid);
btrfs_release_path(NULL, p); btrfs_release_path(p);
ret = -EAGAIN; ret = -EAGAIN;
tmp = read_tree_block(root, blocknr, blocksize, 0); tmp = read_tree_block(root, blocknr, blocksize, 0);
...@@ -1563,7 +1563,7 @@ setup_nodes_for_search(struct btrfs_trans_handle *trans, ...@@ -1563,7 +1563,7 @@ setup_nodes_for_search(struct btrfs_trans_handle *trans,
} }
b = p->nodes[level]; b = p->nodes[level];
if (!b) { if (!b) {
btrfs_release_path(NULL, p); btrfs_release_path(p);
goto again; goto again;
} }
BUG_ON(btrfs_header_nritems(b) == 1); BUG_ON(btrfs_header_nritems(b) == 1);
...@@ -1753,7 +1753,7 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root ...@@ -1753,7 +1753,7 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
if (!p->leave_spinning) if (!p->leave_spinning)
btrfs_set_path_blocking(p); btrfs_set_path_blocking(p);
if (ret < 0) if (ret < 0)
btrfs_release_path(root, p); btrfs_release_path(p);
return ret; return ret;
} }
...@@ -3026,7 +3026,7 @@ static noinline int setup_leaf_for_split(struct btrfs_trans_handle *trans, ...@@ -3026,7 +3026,7 @@ static noinline int setup_leaf_for_split(struct btrfs_trans_handle *trans,
struct btrfs_file_extent_item); struct btrfs_file_extent_item);
extent_len = btrfs_file_extent_num_bytes(leaf, fi); extent_len = btrfs_file_extent_num_bytes(leaf, fi);
} }
btrfs_release_path(root, path); btrfs_release_path(path);
path->keep_locks = 1; path->keep_locks = 1;
path->search_for_split = 1; path->search_for_split = 1;
...@@ -3948,7 +3948,7 @@ int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path) ...@@ -3948,7 +3948,7 @@ int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path)
else else
return 1; return 1;
btrfs_release_path(root, path); btrfs_release_path(path);
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -4072,7 +4072,7 @@ int btrfs_search_forward(struct btrfs_root *root, struct btrfs_key *min_key, ...@@ -4072,7 +4072,7 @@ int btrfs_search_forward(struct btrfs_root *root, struct btrfs_key *min_key,
sret = btrfs_find_next_key(root, path, min_key, level, sret = btrfs_find_next_key(root, path, min_key, level,
cache_only, min_trans); cache_only, min_trans);
if (sret == 0) { if (sret == 0) {
btrfs_release_path(root, path); btrfs_release_path(path);
goto again; goto again;
} else { } else {
goto out; goto out;
...@@ -4151,7 +4151,7 @@ int btrfs_find_next_key(struct btrfs_root *root, struct btrfs_path *path, ...@@ -4151,7 +4151,7 @@ int btrfs_find_next_key(struct btrfs_root *root, struct btrfs_path *path,
btrfs_node_key_to_cpu(c, &cur_key, slot); btrfs_node_key_to_cpu(c, &cur_key, slot);
orig_lowest = path->lowest_level; orig_lowest = path->lowest_level;
btrfs_release_path(root, path); btrfs_release_path(path);
path->lowest_level = level; path->lowest_level = level;
ret = btrfs_search_slot(NULL, root, &cur_key, path, ret = btrfs_search_slot(NULL, root, &cur_key, path,
0, 0); 0, 0);
...@@ -4228,7 +4228,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path) ...@@ -4228,7 +4228,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
again: again:
level = 1; level = 1;
next = NULL; next = NULL;
btrfs_release_path(root, path); btrfs_release_path(path);
path->keep_locks = 1; path->keep_locks = 1;
...@@ -4284,7 +4284,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path) ...@@ -4284,7 +4284,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
goto again; goto again;
if (ret < 0) { if (ret < 0) {
btrfs_release_path(root, path); btrfs_release_path(path);
goto done; goto done;
} }
...@@ -4323,7 +4323,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path) ...@@ -4323,7 +4323,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
goto again; goto again;
if (ret < 0) { if (ret < 0) {
btrfs_release_path(root, path); btrfs_release_path(path);
goto done; goto done;
} }
......
...@@ -2290,7 +2290,7 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, ...@@ -2290,7 +2290,7 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct extent_buffer *parent, struct btrfs_root *root, struct extent_buffer *parent,
int start_slot, int cache_only, u64 *last_ret, int start_slot, int cache_only, u64 *last_ret,
struct btrfs_key *progress); struct btrfs_key *progress);
void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p); void btrfs_release_path(struct btrfs_path *p);
struct btrfs_path *btrfs_alloc_path(void); struct btrfs_path *btrfs_alloc_path(void);
void btrfs_free_path(struct btrfs_path *p); void btrfs_free_path(struct btrfs_path *p);
void btrfs_set_path_blocking(struct btrfs_path *p); void btrfs_set_path_blocking(struct btrfs_path *p);
......
...@@ -172,7 +172,7 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root ...@@ -172,7 +172,7 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
ret = 0; ret = 0;
goto out_free; goto out_free;
} }
btrfs_release_path(root, path); btrfs_release_path(path);
btrfs_set_key_type(&key, BTRFS_DIR_INDEX_KEY); btrfs_set_key_type(&key, BTRFS_DIR_INDEX_KEY);
key.offset = index; key.offset = index;
......
...@@ -379,7 +379,7 @@ static int caching_kthread(void *data) ...@@ -379,7 +379,7 @@ static int caching_kthread(void *data)
break; break;
caching_ctl->progress = last; caching_ctl->progress = last;
btrfs_release_path(extent_root, path); btrfs_release_path(path);
up_read(&fs_info->extent_commit_sem); up_read(&fs_info->extent_commit_sem);
mutex_unlock(&caching_ctl->mutex); mutex_unlock(&caching_ctl->mutex);
if (btrfs_transaction_in_commit(fs_info)) if (btrfs_transaction_in_commit(fs_info))
...@@ -754,7 +754,7 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans, ...@@ -754,7 +754,7 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,
atomic_inc(&head->node.refs); atomic_inc(&head->node.refs);
spin_unlock(&delayed_refs->lock); spin_unlock(&delayed_refs->lock);
btrfs_release_path(root->fs_info->extent_root, path); btrfs_release_path(path);
mutex_lock(&head->mutex); mutex_lock(&head->mutex);
mutex_unlock(&head->mutex); mutex_unlock(&head->mutex);
...@@ -934,7 +934,7 @@ static int convert_extent_item_v0(struct btrfs_trans_handle *trans, ...@@ -934,7 +934,7 @@ static int convert_extent_item_v0(struct btrfs_trans_handle *trans,
break; break;
} }
} }
btrfs_release_path(root, path); btrfs_release_path(path);
if (owner < BTRFS_FIRST_FREE_OBJECTID) if (owner < BTRFS_FIRST_FREE_OBJECTID)
new_size += sizeof(*bi); new_size += sizeof(*bi);
...@@ -1042,7 +1042,7 @@ static noinline int lookup_extent_data_ref(struct btrfs_trans_handle *trans, ...@@ -1042,7 +1042,7 @@ static noinline int lookup_extent_data_ref(struct btrfs_trans_handle *trans,
return 0; return 0;
#ifdef BTRFS_COMPAT_EXTENT_TREE_V0 #ifdef BTRFS_COMPAT_EXTENT_TREE_V0
key.type = BTRFS_EXTENT_REF_V0_KEY; key.type = BTRFS_EXTENT_REF_V0_KEY;
btrfs_release_path(root, path); btrfs_release_path(path);
ret = btrfs_search_slot(trans, root, &key, path, -1, 1); ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
if (ret < 0) { if (ret < 0) {
err = ret; err = ret;
...@@ -1080,7 +1080,7 @@ static noinline int lookup_extent_data_ref(struct btrfs_trans_handle *trans, ...@@ -1080,7 +1080,7 @@ static noinline int lookup_extent_data_ref(struct btrfs_trans_handle *trans,
if (match_extent_data_ref(leaf, ref, root_objectid, if (match_extent_data_ref(leaf, ref, root_objectid,
owner, offset)) { owner, offset)) {
if (recow) { if (recow) {
btrfs_release_path(root, path); btrfs_release_path(path);
goto again; goto again;
} }
err = 0; err = 0;
...@@ -1141,7 +1141,7 @@ static noinline int insert_extent_data_ref(struct btrfs_trans_handle *trans, ...@@ -1141,7 +1141,7 @@ static noinline int insert_extent_data_ref(struct btrfs_trans_handle *trans,
if (match_extent_data_ref(leaf, ref, root_objectid, if (match_extent_data_ref(leaf, ref, root_objectid,
owner, offset)) owner, offset))
break; break;
btrfs_release_path(root, path); btrfs_release_path(path);
key.offset++; key.offset++;
ret = btrfs_insert_empty_item(trans, root, path, &key, ret = btrfs_insert_empty_item(trans, root, path, &key,
size); size);
...@@ -1167,7 +1167,7 @@ static noinline int insert_extent_data_ref(struct btrfs_trans_handle *trans, ...@@ -1167,7 +1167,7 @@ static noinline int insert_extent_data_ref(struct btrfs_trans_handle *trans,
btrfs_mark_buffer_dirty(leaf); btrfs_mark_buffer_dirty(leaf);
ret = 0; ret = 0;
fail: fail:
btrfs_release_path(root, path); btrfs_release_path(path);
return ret; return ret;
} }
...@@ -1293,7 +1293,7 @@ static noinline int lookup_tree_block_ref(struct btrfs_trans_handle *trans, ...@@ -1293,7 +1293,7 @@ static noinline int lookup_tree_block_ref(struct btrfs_trans_handle *trans,
ret = -ENOENT; ret = -ENOENT;
#ifdef BTRFS_COMPAT_EXTENT_TREE_V0 #ifdef BTRFS_COMPAT_EXTENT_TREE_V0
if (ret == -ENOENT && parent) { if (ret == -ENOENT && parent) {
btrfs_release_path(root, path); btrfs_release_path(path);
key.type = BTRFS_EXTENT_REF_V0_KEY; key.type = BTRFS_EXTENT_REF_V0_KEY;
ret = btrfs_search_slot(trans, root, &key, path, -1, 1); ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
if (ret > 0) if (ret > 0)
...@@ -1322,7 +1322,7 @@ static noinline int insert_tree_block_ref(struct btrfs_trans_handle *trans, ...@@ -1322,7 +1322,7 @@ static noinline int insert_tree_block_ref(struct btrfs_trans_handle *trans,
} }
ret = btrfs_insert_empty_item(trans, root, path, &key, 0); ret = btrfs_insert_empty_item(trans, root, path, &key, 0);
btrfs_release_path(root, path); btrfs_release_path(path);
return ret; return ret;
} }
...@@ -1608,7 +1608,7 @@ static int lookup_extent_backref(struct btrfs_trans_handle *trans, ...@@ -1608,7 +1608,7 @@ static int lookup_extent_backref(struct btrfs_trans_handle *trans,
if (ret != -ENOENT) if (ret != -ENOENT)
return ret; return ret;
btrfs_release_path(root, path); btrfs_release_path(path);
*ref_ret = NULL; *ref_ret = NULL;
if (owner < BTRFS_FIRST_FREE_OBJECTID) { if (owner < BTRFS_FIRST_FREE_OBJECTID) {
...@@ -1862,7 +1862,7 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, ...@@ -1862,7 +1862,7 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
__run_delayed_extent_op(extent_op, leaf, item); __run_delayed_extent_op(extent_op, leaf, item);
btrfs_mark_buffer_dirty(leaf); btrfs_mark_buffer_dirty(leaf);
btrfs_release_path(root->fs_info->extent_root, path); btrfs_release_path(path);
path->reada = 1; path->reada = 1;
path->leave_spinning = 1; path->leave_spinning = 1;
...@@ -2361,7 +2361,7 @@ static noinline int check_delayed_ref(struct btrfs_trans_handle *trans, ...@@ -2361,7 +2361,7 @@ static noinline int check_delayed_ref(struct btrfs_trans_handle *trans,
atomic_inc(&head->node.refs); atomic_inc(&head->node.refs);
spin_unlock(&delayed_refs->lock); spin_unlock(&delayed_refs->lock);
btrfs_release_path(root->fs_info->extent_root, path); btrfs_release_path(path);
mutex_lock(&head->mutex); mutex_lock(&head->mutex);
mutex_unlock(&head->mutex); mutex_unlock(&head->mutex);
...@@ -2732,7 +2732,7 @@ static int write_one_cache_group(struct btrfs_trans_handle *trans, ...@@ -2732,7 +2732,7 @@ static int write_one_cache_group(struct btrfs_trans_handle *trans,
bi = btrfs_item_ptr_offset(leaf, path->slots[0]); bi = btrfs_item_ptr_offset(leaf, path->slots[0]);
write_extent_buffer(leaf, &cache->item, bi, sizeof(cache->item)); write_extent_buffer(leaf, &cache->item, bi, sizeof(cache->item));
btrfs_mark_buffer_dirty(leaf); btrfs_mark_buffer_dirty(leaf);
btrfs_release_path(extent_root, path); btrfs_release_path(path);
fail: fail:
if (ret) if (ret)
return ret; return ret;
...@@ -2785,7 +2785,7 @@ static int cache_save_setup(struct btrfs_block_group_cache *block_group, ...@@ -2785,7 +2785,7 @@ static int cache_save_setup(struct btrfs_block_group_cache *block_group,
inode = lookup_free_space_inode(root, block_group, path); inode = lookup_free_space_inode(root, block_group, path);
if (IS_ERR(inode) && PTR_ERR(inode) != -ENOENT) { if (IS_ERR(inode) && PTR_ERR(inode) != -ENOENT) {
ret = PTR_ERR(inode); ret = PTR_ERR(inode);
btrfs_release_path(root, path); btrfs_release_path(path);
goto out; goto out;
} }
...@@ -2854,7 +2854,7 @@ static int cache_save_setup(struct btrfs_block_group_cache *block_group, ...@@ -2854,7 +2854,7 @@ static int cache_save_setup(struct btrfs_block_group_cache *block_group,
out_put: out_put:
iput(inode); iput(inode);
out_free: out_free:
btrfs_release_path(root, path); btrfs_release_path(path);
out: out:
spin_lock(&block_group->lock); spin_lock(&block_group->lock);
block_group->disk_cache_state = dcs; block_group->disk_cache_state = dcs;
...@@ -4541,7 +4541,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans, ...@@ -4541,7 +4541,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
NULL, refs_to_drop, NULL, refs_to_drop,
is_data); is_data);
BUG_ON(ret); BUG_ON(ret);
btrfs_release_path(extent_root, path); btrfs_release_path(path);
path->leave_spinning = 1; path->leave_spinning = 1;
key.objectid = bytenr; key.objectid = bytenr;
...@@ -4580,7 +4580,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans, ...@@ -4580,7 +4580,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
owner_objectid, 0); owner_objectid, 0);
BUG_ON(ret < 0); BUG_ON(ret < 0);
btrfs_release_path(extent_root, path); btrfs_release_path(path);
path->leave_spinning = 1; path->leave_spinning = 1;
key.objectid = bytenr; key.objectid = bytenr;
...@@ -4650,7 +4650,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans, ...@@ -4650,7 +4650,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
ret = btrfs_del_items(trans, extent_root, path, path->slots[0], ret = btrfs_del_items(trans, extent_root, path, path->slots[0],
num_to_del); num_to_del);
BUG_ON(ret); BUG_ON(ret);
btrfs_release_path(extent_root, path); btrfs_release_path(path);
if (is_data) { if (is_data) {
ret = btrfs_del_csums(trans, root, bytenr, num_bytes); ret = btrfs_del_csums(trans, root, bytenr, num_bytes);
...@@ -6480,7 +6480,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, ...@@ -6480,7 +6480,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
trans->block_rsv = block_rsv; trans->block_rsv = block_rsv;
} }
} }
btrfs_release_path(root, path); btrfs_release_path(path);
BUG_ON(err); BUG_ON(err);
ret = btrfs_del_root(trans, tree_root, &root->root_key); ret = btrfs_del_root(trans, tree_root, &root->root_key);
...@@ -8580,7 +8580,7 @@ int btrfs_read_block_groups(struct btrfs_root *root) ...@@ -8580,7 +8580,7 @@ int btrfs_read_block_groups(struct btrfs_root *root)
memcpy(&cache->key, &found_key, sizeof(found_key)); memcpy(&cache->key, &found_key, sizeof(found_key));
key.objectid = found_key.objectid + found_key.offset; key.objectid = found_key.objectid + found_key.offset;
btrfs_release_path(root, path); btrfs_release_path(path);
cache->flags = btrfs_block_group_flags(&cache->item); cache->flags = btrfs_block_group_flags(&cache->item);
cache->sectorsize = root->sectorsize; cache->sectorsize = root->sectorsize;
...@@ -8802,12 +8802,12 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, ...@@ -8802,12 +8802,12 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
if (ret < 0) if (ret < 0)
goto out; goto out;
if (ret > 0) if (ret > 0)
btrfs_release_path(tree_root, path); btrfs_release_path(path);
if (ret == 0) { if (ret == 0) {
ret = btrfs_del_item(trans, tree_root, path); ret = btrfs_del_item(trans, tree_root, path);
if (ret) if (ret)
goto out; goto out;
btrfs_release_path(tree_root, path); btrfs_release_path(path);
} }
spin_lock(&root->fs_info->block_group_cache_lock); spin_lock(&root->fs_info->block_group_cache_lock);
......
...@@ -193,7 +193,7 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root, ...@@ -193,7 +193,7 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root,
u32 item_size; u32 item_size;
if (item) if (item)
btrfs_release_path(root, path); btrfs_release_path(path);
item = btrfs_lookup_csum(NULL, root->fs_info->csum_root, item = btrfs_lookup_csum(NULL, root->fs_info->csum_root,
path, disk_bytenr, 0); path, disk_bytenr, 0);
if (IS_ERR(item)) { if (IS_ERR(item)) {
...@@ -213,7 +213,7 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root, ...@@ -213,7 +213,7 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root,
(unsigned long long)offset); (unsigned long long)offset);
} }
item = NULL; item = NULL;
btrfs_release_path(root, path); btrfs_release_path(path);
goto found; goto found;
} }
btrfs_item_key_to_cpu(path->nodes[0], &found_key, btrfs_item_key_to_cpu(path->nodes[0], &found_key,
...@@ -631,7 +631,7 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans, ...@@ -631,7 +631,7 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
if (key.offset < bytenr) if (key.offset < bytenr)
break; break;
} }
btrfs_release_path(root, path); btrfs_release_path(path);
} }
out: out:
btrfs_free_path(path); btrfs_free_path(path);
...@@ -722,7 +722,7 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans, ...@@ -722,7 +722,7 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
* at this point, we know the tree has an item, but it isn't big * at this point, we know the tree has an item, but it isn't big
* enough yet to put our csum in. Grow it * enough yet to put our csum in. Grow it
*/ */
btrfs_release_path(root, path); btrfs_release_path(path);
ret = btrfs_search_slot(trans, root, &file_key, path, ret = btrfs_search_slot(trans, root, &file_key, path,
csum_size, 1); csum_size, 1);
if (ret < 0) if (ret < 0)
...@@ -766,7 +766,7 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans, ...@@ -766,7 +766,7 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
} }
insert: insert:
btrfs_release_path(root, path); btrfs_release_path(path);
csum_offset = 0; csum_offset = 0;
if (found_next) { if (found_next) {
u64 tmp = total_bytes + root->sectorsize; u64 tmp = total_bytes + root->sectorsize;
...@@ -850,7 +850,7 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans, ...@@ -850,7 +850,7 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
} }
btrfs_mark_buffer_dirty(path->nodes[0]); btrfs_mark_buffer_dirty(path->nodes[0]);
if (total_bytes < sums->len) { if (total_bytes < sums->len) {
btrfs_release_path(root, path); btrfs_release_path(path);
cond_resched(); cond_resched();
goto again; goto again;
} }
......
...@@ -376,7 +376,7 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans, struct inode *inode, ...@@ -376,7 +376,7 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans, struct inode *inode,
search_start = max(key.offset, start); search_start = max(key.offset, start);
if (recow) { if (recow) {
btrfs_release_path(root, path); btrfs_release_path(path);
continue; continue;
} }
...@@ -393,7 +393,7 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans, struct inode *inode, ...@@ -393,7 +393,7 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans, struct inode *inode,
ret = btrfs_duplicate_item(trans, root, path, ret = btrfs_duplicate_item(trans, root, path,
&new_key); &new_key);
if (ret == -EAGAIN) { if (ret == -EAGAIN) {
btrfs_release_path(root, path); btrfs_release_path(path);
continue; continue;
} }
if (ret < 0) if (ret < 0)
...@@ -516,7 +516,7 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans, struct inode *inode, ...@@ -516,7 +516,7 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans, struct inode *inode,
del_nr = 0; del_nr = 0;
del_slot = 0; del_slot = 0;
btrfs_release_path(root, path); btrfs_release_path(path);
continue; continue;
} }
...@@ -681,7 +681,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, ...@@ -681,7 +681,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
new_key.offset = split; new_key.offset = split;
ret = btrfs_duplicate_item(trans, root, path, &new_key); ret = btrfs_duplicate_item(trans, root, path, &new_key);
if (ret == -EAGAIN) { if (ret == -EAGAIN) {
btrfs_release_path(root, path); btrfs_release_path(path);
goto again; goto again;
} }
BUG_ON(ret < 0); BUG_ON(ret < 0);
...@@ -721,7 +721,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, ...@@ -721,7 +721,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
inode->i_ino, bytenr, orig_offset, inode->i_ino, bytenr, orig_offset,
&other_start, &other_end)) { &other_start, &other_end)) {
if (recow) { if (recow) {
btrfs_release_path(root, path); btrfs_release_path(path);
goto again; goto again;
} }
extent_end = other_end; extent_end = other_end;
...@@ -738,7 +738,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, ...@@ -738,7 +738,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
inode->i_ino, bytenr, orig_offset, inode->i_ino, bytenr, orig_offset,
&other_start, &other_end)) { &other_start, &other_end)) {
if (recow) { if (recow) {
btrfs_release_path(root, path); btrfs_release_path(path);
goto again; goto again;
} }
key.offset = other_start; key.offset = other_start;
......
...@@ -61,7 +61,7 @@ struct inode *lookup_free_space_inode(struct btrfs_root *root, ...@@ -61,7 +61,7 @@ struct inode *lookup_free_space_inode(struct btrfs_root *root,
if (ret < 0) if (ret < 0)
return ERR_PTR(ret); return ERR_PTR(ret);
if (ret > 0) { if (ret > 0) {
btrfs_release_path(root, path); btrfs_release_path(path);
return ERR_PTR(-ENOENT); return ERR_PTR(-ENOENT);
} }
...@@ -70,7 +70,7 @@ struct inode *lookup_free_space_inode(struct btrfs_root *root, ...@@ -70,7 +70,7 @@ struct inode *lookup_free_space_inode(struct btrfs_root *root,
struct btrfs_free_space_header); struct btrfs_free_space_header);
btrfs_free_space_key(leaf, header, &disk_key); btrfs_free_space_key(leaf, header, &disk_key);
btrfs_disk_key_to_cpu(&location, &disk_key); btrfs_disk_key_to_cpu(&location, &disk_key);
btrfs_release_path(root, path); btrfs_release_path(path);
inode = btrfs_iget(root->fs_info->sb, &location, root, NULL); inode = btrfs_iget(root->fs_info->sb, &location, root, NULL);
if (!inode) if (!inode)
...@@ -134,7 +134,7 @@ int create_free_space_inode(struct btrfs_root *root, ...@@ -134,7 +134,7 @@ int create_free_space_inode(struct btrfs_root *root,
btrfs_set_inode_block_group(leaf, inode_item, btrfs_set_inode_block_group(leaf, inode_item,
block_group->key.objectid); block_group->key.objectid);
btrfs_mark_buffer_dirty(leaf); btrfs_mark_buffer_dirty(leaf);
btrfs_release_path(root, path); btrfs_release_path(path);
key.objectid = BTRFS_FREE_SPACE_OBJECTID; key.objectid = BTRFS_FREE_SPACE_OBJECTID;
key.offset = block_group->key.objectid; key.offset = block_group->key.objectid;
...@@ -143,7 +143,7 @@ int create_free_space_inode(struct btrfs_root *root, ...@@ -143,7 +143,7 @@ int create_free_space_inode(struct btrfs_root *root,
ret = btrfs_insert_empty_item(trans, root, path, &key, ret = btrfs_insert_empty_item(trans, root, path, &key,
sizeof(struct btrfs_free_space_header)); sizeof(struct btrfs_free_space_header));
if (ret < 0) { if (ret < 0) {
btrfs_release_path(root, path); btrfs_release_path(path);
return ret; return ret;
} }
leaf = path->nodes[0]; leaf = path->nodes[0];
...@@ -152,7 +152,7 @@ int create_free_space_inode(struct btrfs_root *root, ...@@ -152,7 +152,7 @@ int create_free_space_inode(struct btrfs_root *root,
memset_extent_buffer(leaf, 0, (unsigned long)header, sizeof(*header)); memset_extent_buffer(leaf, 0, (unsigned long)header, sizeof(*header));
btrfs_set_free_space_key(leaf, header, &disk_key); btrfs_set_free_space_key(leaf, header, &disk_key);
btrfs_mark_buffer_dirty(leaf); btrfs_mark_buffer_dirty(leaf);
btrfs_release_path(root, path); btrfs_release_path(path);
return 0; return 0;
} }
...@@ -822,7 +822,7 @@ int btrfs_write_out_cache(struct btrfs_root *root, ...@@ -822,7 +822,7 @@ int btrfs_write_out_cache(struct btrfs_root *root,
EXTENT_DIRTY | EXTENT_DELALLOC | EXTENT_DIRTY | EXTENT_DELALLOC |
EXTENT_DO_ACCOUNTING, 0, 0, NULL, EXTENT_DO_ACCOUNTING, 0, 0, NULL,
GFP_NOFS); GFP_NOFS);
btrfs_release_path(root, path); btrfs_release_path(path);
goto out_free; goto out_free;
} }
} }
...@@ -832,7 +832,7 @@ int btrfs_write_out_cache(struct btrfs_root *root, ...@@ -832,7 +832,7 @@ int btrfs_write_out_cache(struct btrfs_root *root,
btrfs_set_free_space_bitmaps(leaf, header, bitmaps); btrfs_set_free_space_bitmaps(leaf, header, bitmaps);
btrfs_set_free_space_generation(leaf, header, trans->transid); btrfs_set_free_space_generation(leaf, header, trans->transid);
btrfs_mark_buffer_dirty(leaf); btrfs_mark_buffer_dirty(leaf);
btrfs_release_path(root, path); btrfs_release_path(path);
ret = 1; ret = 1;
......
...@@ -1164,7 +1164,7 @@ static noinline int run_delalloc_nocow(struct inode *inode, ...@@ -1164,7 +1164,7 @@ static noinline int run_delalloc_nocow(struct inode *inode,
goto next_slot; goto next_slot;
} }
btrfs_release_path(root, path); btrfs_release_path(path);
if (cow_start != (u64)-1) { if (cow_start != (u64)-1) {
ret = cow_file_range(inode, locked_page, cow_start, ret = cow_file_range(inode, locked_page, cow_start,
found_key.offset - 1, page_started, found_key.offset - 1, page_started,
...@@ -1222,7 +1222,7 @@ static noinline int run_delalloc_nocow(struct inode *inode, ...@@ -1222,7 +1222,7 @@ static noinline int run_delalloc_nocow(struct inode *inode,
if (cur_offset > end) if (cur_offset > end)
break; break;
} }
btrfs_release_path(root, path); btrfs_release_path(path);
if (cur_offset <= end && cow_start == (u64)-1) if (cur_offset <= end && cow_start == (u64)-1)
cow_start = cur_offset; cow_start = cur_offset;
...@@ -2346,7 +2346,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root) ...@@ -2346,7 +2346,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
break; break;
/* release the path since we're done with it */ /* release the path since we're done with it */
btrfs_release_path(root, path); btrfs_release_path(path);
/* /*
* this is where we are basically btrfs_lookup, without the * this is where we are basically btrfs_lookup, without the
...@@ -2712,7 +2712,7 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans, ...@@ -2712,7 +2712,7 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
ret = btrfs_delete_one_dir_name(trans, root, path, di); ret = btrfs_delete_one_dir_name(trans, root, path, di);
if (ret) if (ret)
goto err; goto err;
btrfs_release_path(root, path); btrfs_release_path(path);
ret = btrfs_del_inode_ref(trans, root, name, name_len, ret = btrfs_del_inode_ref(trans, root, name, name_len,
inode->i_ino, inode->i_ino,
...@@ -2735,7 +2735,7 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans, ...@@ -2735,7 +2735,7 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
goto err; goto err;
} }
ret = btrfs_delete_one_dir_name(trans, root, path, di); ret = btrfs_delete_one_dir_name(trans, root, path, di);
btrfs_release_path(root, path); btrfs_release_path(path);
ret = btrfs_del_inode_ref_in_log(trans, root, name, name_len, ret = btrfs_del_inode_ref_in_log(trans, root, name, name_len,
inode, dir->i_ino); inode, dir->i_ino);
...@@ -2862,7 +2862,7 @@ static struct btrfs_trans_handle *__unlink_start_trans(struct inode *dir, ...@@ -2862,7 +2862,7 @@ static struct btrfs_trans_handle *__unlink_start_trans(struct inode *dir,
} else { } else {
check_link = 0; check_link = 0;
} }
btrfs_release_path(root, path); btrfs_release_path(path);
ret = btrfs_lookup_inode(trans, root, path, ret = btrfs_lookup_inode(trans, root, path,
&BTRFS_I(inode)->location, 0); &BTRFS_I(inode)->location, 0);
...@@ -2876,7 +2876,7 @@ static struct btrfs_trans_handle *__unlink_start_trans(struct inode *dir, ...@@ -2876,7 +2876,7 @@ static struct btrfs_trans_handle *__unlink_start_trans(struct inode *dir,
} else { } else {
check_link = 0; check_link = 0;
} }
btrfs_release_path(root, path); btrfs_release_path(path);
if (ret == 0 && S_ISREG(inode->i_mode)) { if (ret == 0 && S_ISREG(inode->i_mode)) {
ret = btrfs_lookup_file_extent(trans, root, path, ret = btrfs_lookup_file_extent(trans, root, path,
...@@ -2888,7 +2888,7 @@ static struct btrfs_trans_handle *__unlink_start_trans(struct inode *dir, ...@@ -2888,7 +2888,7 @@ static struct btrfs_trans_handle *__unlink_start_trans(struct inode *dir,
BUG_ON(ret == 0); BUG_ON(ret == 0);
if (check_path_shared(root, path)) if (check_path_shared(root, path))
goto out; goto out;
btrfs_release_path(root, path); btrfs_release_path(path);
} }
if (!check_link) { if (!check_link) {
...@@ -2909,7 +2909,7 @@ static struct btrfs_trans_handle *__unlink_start_trans(struct inode *dir, ...@@ -2909,7 +2909,7 @@ static struct btrfs_trans_handle *__unlink_start_trans(struct inode *dir,
err = 0; err = 0;
goto out; goto out;
} }
btrfs_release_path(root, path); btrfs_release_path(path);
ref = btrfs_lookup_inode_ref(trans, root, path, ref = btrfs_lookup_inode_ref(trans, root, path,
dentry->d_name.name, dentry->d_name.len, dentry->d_name.name, dentry->d_name.len,
...@@ -2922,7 +2922,7 @@ static struct btrfs_trans_handle *__unlink_start_trans(struct inode *dir, ...@@ -2922,7 +2922,7 @@ static struct btrfs_trans_handle *__unlink_start_trans(struct inode *dir,
if (check_path_shared(root, path)) if (check_path_shared(root, path))
goto out; goto out;
index = btrfs_inode_ref_index(path->nodes[0], ref); index = btrfs_inode_ref_index(path->nodes[0], ref);
btrfs_release_path(root, path); btrfs_release_path(path);
di = btrfs_lookup_dir_index_item(trans, root, path, dir->i_ino, index, di = btrfs_lookup_dir_index_item(trans, root, path, dir->i_ino, index,
dentry->d_name.name, dentry->d_name.len, 0); dentry->d_name.name, dentry->d_name.len, 0);
...@@ -3013,7 +3013,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans, ...@@ -3013,7 +3013,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
WARN_ON(key.type != BTRFS_ROOT_ITEM_KEY || key.objectid != objectid); WARN_ON(key.type != BTRFS_ROOT_ITEM_KEY || key.objectid != objectid);
ret = btrfs_delete_one_dir_name(trans, root, path, di); ret = btrfs_delete_one_dir_name(trans, root, path, di);
BUG_ON(ret); BUG_ON(ret);
btrfs_release_path(root, path); btrfs_release_path(path);
ret = btrfs_del_root_ref(trans, root->fs_info->tree_root, ret = btrfs_del_root_ref(trans, root->fs_info->tree_root,
objectid, root->root_key.objectid, objectid, root->root_key.objectid,
...@@ -3026,7 +3026,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans, ...@@ -3026,7 +3026,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
leaf = path->nodes[0]; leaf = path->nodes[0];
btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
btrfs_release_path(root, path); btrfs_release_path(path);
index = key.offset; index = key.offset;
} }
...@@ -3039,7 +3039,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans, ...@@ -3039,7 +3039,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
WARN_ON(key.type != BTRFS_ROOT_ITEM_KEY || key.objectid != objectid); WARN_ON(key.type != BTRFS_ROOT_ITEM_KEY || key.objectid != objectid);
ret = btrfs_delete_one_dir_name(trans, root, path, di); ret = btrfs_delete_one_dir_name(trans, root, path, di);
BUG_ON(ret); BUG_ON(ret);
btrfs_release_path(root, path); btrfs_release_path(path);
btrfs_i_size_write(dir, dir->i_size - name_len * 2); btrfs_i_size_write(dir, dir->i_size - name_len * 2);
dir->i_mtime = dir->i_ctime = CURRENT_TIME; dir->i_mtime = dir->i_ctime = CURRENT_TIME;
...@@ -3477,7 +3477,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, ...@@ -3477,7 +3477,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
BUG_ON(ret); BUG_ON(ret);
pending_del_nr = 0; pending_del_nr = 0;
} }
btrfs_release_path(root, path); btrfs_release_path(path);
goto search_again; goto search_again;
} else { } else {
path->slots[0]--; path->slots[0]--;
...@@ -3899,7 +3899,7 @@ static int fixup_tree_root_location(struct btrfs_root *root, ...@@ -3899,7 +3899,7 @@ static int fixup_tree_root_location(struct btrfs_root *root,
if (ret) if (ret)
goto out; goto out;
btrfs_release_path(root->fs_info->tree_root, path); btrfs_release_path(path);
new_root = btrfs_read_fs_root_no_name(root->fs_info, location); new_root = btrfs_read_fs_root_no_name(root->fs_info, location);
if (IS_ERR(new_root)) { if (IS_ERR(new_root)) {
...@@ -5223,7 +5223,7 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page, ...@@ -5223,7 +5223,7 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page,
kunmap(page); kunmap(page);
free_extent_map(em); free_extent_map(em);
em = NULL; em = NULL;
btrfs_release_path(root, path); btrfs_release_path(path);
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root, 1);
if (IS_ERR(trans)) if (IS_ERR(trans))
return ERR_CAST(trans); return ERR_CAST(trans);
...@@ -5249,7 +5249,7 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page, ...@@ -5249,7 +5249,7 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page,
em->block_start = EXTENT_MAP_HOLE; em->block_start = EXTENT_MAP_HOLE;
set_bit(EXTENT_FLAG_VACANCY, &em->flags); set_bit(EXTENT_FLAG_VACANCY, &em->flags);
insert: insert:
btrfs_release_path(root, path); btrfs_release_path(path);
if (em->start > start || extent_map_end(em) <= start) { if (em->start > start || extent_map_end(em) <= start) {
printk(KERN_ERR "Btrfs: bad extent! em: [%llu %llu] passed " printk(KERN_ERR "Btrfs: bad extent! em: [%llu %llu] passed "
"[%llu %llu]\n", (unsigned long long)em->start, "[%llu %llu]\n", (unsigned long long)em->start,
......
...@@ -1396,7 +1396,7 @@ static noinline int search_ioctl(struct inode *inode, ...@@ -1396,7 +1396,7 @@ static noinline int search_ioctl(struct inode *inode,
} }
ret = copy_to_sk(root, path, &key, sk, args->buf, ret = copy_to_sk(root, path, &key, sk, args->buf,
&sk_offset, &num_found); &sk_offset, &num_found);
btrfs_release_path(root, path); btrfs_release_path(path);
if (ret || num_found >= sk->nr_items) if (ret || num_found >= sk->nr_items)
break; break;
...@@ -1503,7 +1503,7 @@ static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info, ...@@ -1503,7 +1503,7 @@ static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info,
if (key.offset == BTRFS_FIRST_FREE_OBJECTID) if (key.offset == BTRFS_FIRST_FREE_OBJECTID)
break; break;
btrfs_release_path(root, path); btrfs_release_path(path);
key.objectid = key.offset; key.objectid = key.offset;
key.offset = (u64)-1; key.offset = (u64)-1;
dirid = key.objectid; dirid = key.objectid;
...@@ -1982,7 +1982,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, ...@@ -1982,7 +1982,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
datal = btrfs_file_extent_ram_bytes(leaf, datal = btrfs_file_extent_ram_bytes(leaf,
extent); extent);
} }
btrfs_release_path(root, path); btrfs_release_path(path);
if (key.offset + datal <= off || if (key.offset + datal <= off ||
key.offset >= off+len) key.offset >= off+len)
...@@ -2092,7 +2092,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, ...@@ -2092,7 +2092,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
} }
btrfs_mark_buffer_dirty(leaf); btrfs_mark_buffer_dirty(leaf);
btrfs_release_path(root, path); btrfs_release_path(path);
inode->i_mtime = inode->i_ctime = CURRENT_TIME; inode->i_mtime = inode->i_ctime = CURRENT_TIME;
...@@ -2113,12 +2113,12 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, ...@@ -2113,12 +2113,12 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
btrfs_end_transaction(trans, root); btrfs_end_transaction(trans, root);
} }
next: next:
btrfs_release_path(root, path); btrfs_release_path(path);
key.offset++; key.offset++;
} }
ret = 0; ret = 0;
out: out:
btrfs_release_path(root, path); btrfs_release_path(path);
unlock_extent(&BTRFS_I(src)->io_tree, off, off+len, GFP_NOFS); unlock_extent(&BTRFS_I(src)->io_tree, off, off+len, GFP_NOFS);
out_unlock: out_unlock:
mutex_unlock(&src->i_mutex); mutex_unlock(&src->i_mutex);
......
...@@ -961,7 +961,7 @@ struct backref_node *build_backref_tree(struct reloc_control *rc, ...@@ -961,7 +961,7 @@ struct backref_node *build_backref_tree(struct reloc_control *rc,
lower = upper; lower = upper;
upper = NULL; upper = NULL;
} }
btrfs_release_path(root, path2); btrfs_release_path(path2);
next: next:
if (ptr < end) { if (ptr < end) {
ptr += btrfs_extent_inline_ref_size(key.type); ptr += btrfs_extent_inline_ref_size(key.type);
...@@ -974,7 +974,7 @@ struct backref_node *build_backref_tree(struct reloc_control *rc, ...@@ -974,7 +974,7 @@ struct backref_node *build_backref_tree(struct reloc_control *rc,
if (ptr >= end) if (ptr >= end)
path1->slots[0]++; path1->slots[0]++;
} }
btrfs_release_path(rc->extent_root, path1); btrfs_release_path(path1);
cur->checked = 1; cur->checked = 1;
WARN_ON(exist); WARN_ON(exist);
...@@ -1749,7 +1749,7 @@ int replace_path(struct btrfs_trans_handle *trans, ...@@ -1749,7 +1749,7 @@ int replace_path(struct btrfs_trans_handle *trans,
btrfs_node_key_to_cpu(path->nodes[level], &key, btrfs_node_key_to_cpu(path->nodes[level], &key,
path->slots[level]); path->slots[level]);
btrfs_release_path(src, path); btrfs_release_path(path);
path->lowest_level = level; path->lowest_level = level;
ret = btrfs_search_slot(trans, src, &key, path, 0, 1); ret = btrfs_search_slot(trans, src, &key, path, 0, 1);
...@@ -2496,7 +2496,7 @@ static int do_relocation(struct btrfs_trans_handle *trans, ...@@ -2496,7 +2496,7 @@ static int do_relocation(struct btrfs_trans_handle *trans,
path->locks[upper->level] = 0; path->locks[upper->level] = 0;
slot = path->slots[upper->level]; slot = path->slots[upper->level];
btrfs_release_path(NULL, path); btrfs_release_path(path);
} else { } else {
ret = btrfs_bin_search(upper->eb, key, upper->level, ret = btrfs_bin_search(upper->eb, key, upper->level,
&slot); &slot);
...@@ -2737,7 +2737,7 @@ static int relocate_tree_block(struct btrfs_trans_handle *trans, ...@@ -2737,7 +2737,7 @@ static int relocate_tree_block(struct btrfs_trans_handle *trans,
} else { } else {
path->lowest_level = node->level; path->lowest_level = node->level;
ret = btrfs_search_slot(trans, root, key, path, 0, 1); ret = btrfs_search_slot(trans, root, key, path, 0, 1);
btrfs_release_path(root, path); btrfs_release_path(path);
if (ret > 0) if (ret > 0)
ret = 0; ret = 0;
} }
...@@ -3119,7 +3119,7 @@ static int add_tree_block(struct reloc_control *rc, ...@@ -3119,7 +3119,7 @@ static int add_tree_block(struct reloc_control *rc,
#endif #endif
} }
btrfs_release_path(rc->extent_root, path); btrfs_release_path(path);
BUG_ON(level == -1); BUG_ON(level == -1);
...@@ -3505,7 +3505,7 @@ int add_data_references(struct reloc_control *rc, ...@@ -3505,7 +3505,7 @@ int add_data_references(struct reloc_control *rc,
} }
path->slots[0]++; path->slots[0]++;
} }
btrfs_release_path(rc->extent_root, path); btrfs_release_path(path);
if (err) if (err)
free_block_list(blocks); free_block_list(blocks);
return err; return err;
...@@ -3568,7 +3568,7 @@ int find_next_extent(struct btrfs_trans_handle *trans, ...@@ -3568,7 +3568,7 @@ int find_next_extent(struct btrfs_trans_handle *trans,
EXTENT_DIRTY); EXTENT_DIRTY);
if (ret == 0 && start <= key.objectid) { if (ret == 0 && start <= key.objectid) {
btrfs_release_path(rc->extent_root, path); btrfs_release_path(path);
rc->search_start = end + 1; rc->search_start = end + 1;
} else { } else {
rc->search_start = key.objectid + key.offset; rc->search_start = key.objectid + key.offset;
...@@ -3576,7 +3576,7 @@ int find_next_extent(struct btrfs_trans_handle *trans, ...@@ -3576,7 +3576,7 @@ int find_next_extent(struct btrfs_trans_handle *trans,
return 0; return 0;
} }
} }
btrfs_release_path(rc->extent_root, path); btrfs_release_path(path);
return ret; return ret;
} }
...@@ -3713,7 +3713,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) ...@@ -3713,7 +3713,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
flags = BTRFS_EXTENT_FLAG_DATA; flags = BTRFS_EXTENT_FLAG_DATA;
if (path_change) { if (path_change) {
btrfs_release_path(rc->extent_root, path); btrfs_release_path(path);
path->search_commit_root = 1; path->search_commit_root = 1;
path->skip_locking = 1; path->skip_locking = 1;
...@@ -3736,7 +3736,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) ...@@ -3736,7 +3736,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
(flags & BTRFS_EXTENT_FLAG_DATA)) { (flags & BTRFS_EXTENT_FLAG_DATA)) {
ret = add_data_references(rc, &key, path, &blocks); ret = add_data_references(rc, &key, path, &blocks);
} else { } else {
btrfs_release_path(rc->extent_root, path); btrfs_release_path(path);
ret = 0; ret = 0;
} }
if (ret < 0) { if (ret < 0) {
...@@ -3799,7 +3799,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) ...@@ -3799,7 +3799,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
} }
} }
btrfs_release_path(rc->extent_root, path); btrfs_release_path(path);
clear_extent_bits(&rc->processed_blocks, 0, (u64)-1, EXTENT_DIRTY, clear_extent_bits(&rc->processed_blocks, 0, (u64)-1, EXTENT_DIRTY,
GFP_NOFS); GFP_NOFS);
...@@ -3867,7 +3867,7 @@ static int __insert_orphan_inode(struct btrfs_trans_handle *trans, ...@@ -3867,7 +3867,7 @@ static int __insert_orphan_inode(struct btrfs_trans_handle *trans,
btrfs_set_inode_flags(leaf, item, BTRFS_INODE_NOCOMPRESS | btrfs_set_inode_flags(leaf, item, BTRFS_INODE_NOCOMPRESS |
BTRFS_INODE_PREALLOC); BTRFS_INODE_PREALLOC);
btrfs_mark_buffer_dirty(leaf); btrfs_mark_buffer_dirty(leaf);
btrfs_release_path(root, path); btrfs_release_path(path);
out: out:
btrfs_free_path(path); btrfs_free_path(path);
return ret; return ret;
...@@ -4109,7 +4109,7 @@ int btrfs_recover_relocation(struct btrfs_root *root) ...@@ -4109,7 +4109,7 @@ int btrfs_recover_relocation(struct btrfs_root *root)
} }
leaf = path->nodes[0]; leaf = path->nodes[0];
btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
btrfs_release_path(root->fs_info->tree_root, path); btrfs_release_path(path);
if (key.objectid != BTRFS_TREE_RELOC_OBJECTID || if (key.objectid != BTRFS_TREE_RELOC_OBJECTID ||
key.type != BTRFS_ROOT_ITEM_KEY) key.type != BTRFS_ROOT_ITEM_KEY)
...@@ -4141,7 +4141,7 @@ int btrfs_recover_relocation(struct btrfs_root *root) ...@@ -4141,7 +4141,7 @@ int btrfs_recover_relocation(struct btrfs_root *root)
key.offset--; key.offset--;
} }
btrfs_release_path(root->fs_info->tree_root, path); btrfs_release_path(path);
if (list_empty(&reloc_roots)) if (list_empty(&reloc_roots))
goto out; goto out;
......
...@@ -57,7 +57,7 @@ int btrfs_search_root(struct btrfs_root *root, u64 search_start, ...@@ -57,7 +57,7 @@ int btrfs_search_root(struct btrfs_root *root, u64 search_start,
btrfs_item_key_to_cpu(path->nodes[0], &search_key, path->slots[0]); btrfs_item_key_to_cpu(path->nodes[0], &search_key, path->slots[0]);
if (search_key.type != BTRFS_ROOT_ITEM_KEY) { if (search_key.type != BTRFS_ROOT_ITEM_KEY) {
search_key.offset++; search_key.offset++;
btrfs_release_path(root, path); btrfs_release_path(path);
goto again; goto again;
} }
ret = 0; ret = 0;
...@@ -230,7 +230,7 @@ int btrfs_find_dead_roots(struct btrfs_root *root, u64 objectid) ...@@ -230,7 +230,7 @@ int btrfs_find_dead_roots(struct btrfs_root *root, u64 objectid)
memcpy(&found_key, &key, sizeof(key)); memcpy(&found_key, &key, sizeof(key));
key.offset++; key.offset++;
btrfs_release_path(root, path); btrfs_release_path(path);
dead_root = dead_root =
btrfs_read_fs_root_no_radix(root->fs_info->tree_root, btrfs_read_fs_root_no_radix(root->fs_info->tree_root,
&found_key); &found_key);
...@@ -292,7 +292,7 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root) ...@@ -292,7 +292,7 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root)
} }
btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
btrfs_release_path(tree_root, path); btrfs_release_path(path);
if (key.objectid != BTRFS_ORPHAN_OBJECTID || if (key.objectid != BTRFS_ORPHAN_OBJECTID ||
key.type != BTRFS_ORPHAN_ITEM_KEY) key.type != BTRFS_ORPHAN_ITEM_KEY)
...@@ -390,7 +390,7 @@ int btrfs_del_root_ref(struct btrfs_trans_handle *trans, ...@@ -390,7 +390,7 @@ int btrfs_del_root_ref(struct btrfs_trans_handle *trans,
err = -ENOENT; err = -ENOENT;
if (key.type == BTRFS_ROOT_BACKREF_KEY) { if (key.type == BTRFS_ROOT_BACKREF_KEY) {
btrfs_release_path(tree_root, path); btrfs_release_path(path);
key.objectid = ref_id; key.objectid = ref_id;
key.type = BTRFS_ROOT_REF_KEY; key.type = BTRFS_ROOT_REF_KEY;
key.offset = root_id; key.offset = root_id;
...@@ -463,7 +463,7 @@ int btrfs_add_root_ref(struct btrfs_trans_handle *trans, ...@@ -463,7 +463,7 @@ int btrfs_add_root_ref(struct btrfs_trans_handle *trans,
btrfs_mark_buffer_dirty(leaf); btrfs_mark_buffer_dirty(leaf);
if (key.type == BTRFS_ROOT_BACKREF_KEY) { if (key.type == BTRFS_ROOT_BACKREF_KEY) {
btrfs_release_path(tree_root, path); btrfs_release_path(path);
key.objectid = ref_id; key.objectid = ref_id;
key.type = BTRFS_ROOT_REF_KEY; key.type = BTRFS_ROOT_REF_KEY;
key.offset = root_id; key.offset = root_id;
......
...@@ -97,7 +97,7 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans, ...@@ -97,7 +97,7 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
ret = 0; ret = 0;
goto out; goto out;
} }
btrfs_release_path(root, path); btrfs_release_path(path);
wret = btrfs_search_slot(trans, root, &key, path, 0, 1); wret = btrfs_search_slot(trans, root, &key, path, 0, 1);
if (wret < 0) { if (wret < 0) {
......
...@@ -333,13 +333,13 @@ static noinline int overwrite_item(struct btrfs_trans_handle *trans, ...@@ -333,13 +333,13 @@ static noinline int overwrite_item(struct btrfs_trans_handle *trans,
goto insert; goto insert;
if (item_size == 0) { if (item_size == 0) {
btrfs_release_path(root, path); btrfs_release_path(path);
return 0; return 0;
} }
dst_copy = kmalloc(item_size, GFP_NOFS); dst_copy = kmalloc(item_size, GFP_NOFS);
src_copy = kmalloc(item_size, GFP_NOFS); src_copy = kmalloc(item_size, GFP_NOFS);
if (!dst_copy || !src_copy) { if (!dst_copy || !src_copy) {
btrfs_release_path(root, path); btrfs_release_path(path);
kfree(dst_copy); kfree(dst_copy);
kfree(src_copy); kfree(src_copy);
return -ENOMEM; return -ENOMEM;
...@@ -361,13 +361,13 @@ static noinline int overwrite_item(struct btrfs_trans_handle *trans, ...@@ -361,13 +361,13 @@ static noinline int overwrite_item(struct btrfs_trans_handle *trans,
* sync * sync
*/ */
if (ret == 0) { if (ret == 0) {
btrfs_release_path(root, path); btrfs_release_path(path);
return 0; return 0;
} }
} }
insert: insert:
btrfs_release_path(root, path); btrfs_release_path(path);
/* try to insert the key into the destination tree */ /* try to insert the key into the destination tree */
ret = btrfs_insert_empty_item(trans, root, path, ret = btrfs_insert_empty_item(trans, root, path,
key, item_size); key, item_size);
...@@ -438,7 +438,7 @@ static noinline int overwrite_item(struct btrfs_trans_handle *trans, ...@@ -438,7 +438,7 @@ static noinline int overwrite_item(struct btrfs_trans_handle *trans,
} }
no_copy: no_copy:
btrfs_mark_buffer_dirty(path->nodes[0]); btrfs_mark_buffer_dirty(path->nodes[0]);
btrfs_release_path(root, path); btrfs_release_path(path);
return 0; return 0;
} }
...@@ -544,11 +544,11 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans, ...@@ -544,11 +544,11 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
* we don't have to do anything * we don't have to do anything
*/ */
if (memcmp(&cmp1, &cmp2, sizeof(cmp1)) == 0) { if (memcmp(&cmp1, &cmp2, sizeof(cmp1)) == 0) {
btrfs_release_path(root, path); btrfs_release_path(path);
goto out; goto out;
} }
} }
btrfs_release_path(root, path); btrfs_release_path(path);
saved_nbytes = inode_get_bytes(inode); saved_nbytes = inode_get_bytes(inode);
/* drop any overlapping extents */ /* drop any overlapping extents */
...@@ -600,7 +600,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans, ...@@ -600,7 +600,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
key->objectid, offset, &ins); key->objectid, offset, &ins);
BUG_ON(ret); BUG_ON(ret);
} }
btrfs_release_path(root, path); btrfs_release_path(path);
if (btrfs_file_extent_compression(eb, item)) { if (btrfs_file_extent_compression(eb, item)) {
csum_start = ins.objectid; csum_start = ins.objectid;
...@@ -629,7 +629,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans, ...@@ -629,7 +629,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
kfree(sums); kfree(sums);
} }
} else { } else {
btrfs_release_path(root, path); btrfs_release_path(path);
} }
} else if (found_type == BTRFS_FILE_EXTENT_INLINE) { } else if (found_type == BTRFS_FILE_EXTENT_INLINE) {
/* inline extents are easy, we just overwrite them */ /* inline extents are easy, we just overwrite them */
...@@ -675,7 +675,7 @@ static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans, ...@@ -675,7 +675,7 @@ static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans,
return -ENOMEM; return -ENOMEM;
read_extent_buffer(leaf, name, (unsigned long)(di + 1), name_len); read_extent_buffer(leaf, name, (unsigned long)(di + 1), name_len);
btrfs_release_path(root, path); btrfs_release_path(path);
inode = read_one_inode(root, location.objectid); inode = read_one_inode(root, location.objectid);
BUG_ON(!inode); BUG_ON(!inode);
...@@ -713,7 +713,7 @@ static noinline int inode_in_dir(struct btrfs_root *root, ...@@ -713,7 +713,7 @@ static noinline int inode_in_dir(struct btrfs_root *root,
goto out; goto out;
} else } else
goto out; goto out;
btrfs_release_path(root, path); btrfs_release_path(path);
di = btrfs_lookup_dir_item(NULL, root, path, dirid, name, name_len, 0); di = btrfs_lookup_dir_item(NULL, root, path, dirid, name, name_len, 0);
if (di && !IS_ERR(di)) { if (di && !IS_ERR(di)) {
...@@ -724,7 +724,7 @@ static noinline int inode_in_dir(struct btrfs_root *root, ...@@ -724,7 +724,7 @@ static noinline int inode_in_dir(struct btrfs_root *root,
goto out; goto out;
match = 1; match = 1;
out: out:
btrfs_release_path(root, path); btrfs_release_path(path);
return match; return match;
} }
...@@ -884,7 +884,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans, ...@@ -884,7 +884,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
if (!backref_in_log(log, key, victim_name, if (!backref_in_log(log, key, victim_name,
victim_name_len)) { victim_name_len)) {
btrfs_inc_nlink(inode); btrfs_inc_nlink(inode);
btrfs_release_path(root, path); btrfs_release_path(path);
ret = btrfs_unlink_inode(trans, root, dir, ret = btrfs_unlink_inode(trans, root, dir,
inode, victim_name, inode, victim_name,
...@@ -901,7 +901,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans, ...@@ -901,7 +901,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
*/ */
search_done = 1; search_done = 1;
} }
btrfs_release_path(root, path); btrfs_release_path(path);
insert: insert:
/* insert our name */ /* insert our name */
...@@ -922,7 +922,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans, ...@@ -922,7 +922,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
BUG_ON(ret); BUG_ON(ret);
out_nowrite: out_nowrite:
btrfs_release_path(root, path); btrfs_release_path(path);
iput(dir); iput(dir);
iput(inode); iput(inode);
return 0; return 0;
...@@ -999,9 +999,9 @@ static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans, ...@@ -999,9 +999,9 @@ static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans,
if (key.offset == 0) if (key.offset == 0)
break; break;
key.offset--; key.offset--;
btrfs_release_path(root, path); btrfs_release_path(path);
} }
btrfs_release_path(root, path); btrfs_release_path(path);
if (nlink != inode->i_nlink) { if (nlink != inode->i_nlink) {
inode->i_nlink = nlink; inode->i_nlink = nlink;
btrfs_update_inode(trans, root, inode); btrfs_update_inode(trans, root, inode);
...@@ -1052,7 +1052,7 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans, ...@@ -1052,7 +1052,7 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans,
ret = btrfs_del_item(trans, root, path); ret = btrfs_del_item(trans, root, path);
BUG_ON(ret); BUG_ON(ret);
btrfs_release_path(root, path); btrfs_release_path(path);
inode = read_one_inode(root, key.offset); inode = read_one_inode(root, key.offset);
BUG_ON(!inode); BUG_ON(!inode);
...@@ -1068,7 +1068,7 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans, ...@@ -1068,7 +1068,7 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans,
*/ */
key.offset = (u64)-1; key.offset = (u64)-1;
} }
btrfs_release_path(root, path); btrfs_release_path(path);
return 0; return 0;
} }
...@@ -1096,7 +1096,7 @@ static noinline int link_to_fixup_dir(struct btrfs_trans_handle *trans, ...@@ -1096,7 +1096,7 @@ static noinline int link_to_fixup_dir(struct btrfs_trans_handle *trans,
ret = btrfs_insert_empty_item(trans, root, path, &key, 0); ret = btrfs_insert_empty_item(trans, root, path, &key, 0);
btrfs_release_path(root, path); btrfs_release_path(path);
if (ret == 0) { if (ret == 0) {
btrfs_inc_nlink(inode); btrfs_inc_nlink(inode);
btrfs_update_inode(trans, root, inode); btrfs_update_inode(trans, root, inode);
...@@ -1192,7 +1192,7 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, ...@@ -1192,7 +1192,7 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans,
exists = 1; exists = 1;
else else
exists = 0; exists = 0;
btrfs_release_path(root, path); btrfs_release_path(path);
if (key->type == BTRFS_DIR_ITEM_KEY) { if (key->type == BTRFS_DIR_ITEM_KEY) {
dst_di = btrfs_lookup_dir_item(trans, root, path, key->objectid, dst_di = btrfs_lookup_dir_item(trans, root, path, key->objectid,
...@@ -1236,13 +1236,13 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, ...@@ -1236,13 +1236,13 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans,
if (key->type == BTRFS_DIR_INDEX_KEY) if (key->type == BTRFS_DIR_INDEX_KEY)
goto insert; goto insert;
out: out:
btrfs_release_path(root, path); btrfs_release_path(path);
kfree(name); kfree(name);
iput(dir); iput(dir);
return 0; return 0;
insert: insert:
btrfs_release_path(root, path); btrfs_release_path(path);
ret = insert_one_name(trans, root, path, key->objectid, key->offset, ret = insert_one_name(trans, root, path, key->objectid, key->offset,
name, name_len, log_type, &log_key); name, name_len, log_type, &log_key);
...@@ -1363,7 +1363,7 @@ static noinline int find_dir_range(struct btrfs_root *root, ...@@ -1363,7 +1363,7 @@ static noinline int find_dir_range(struct btrfs_root *root,
*end_ret = found_end; *end_ret = found_end;
ret = 0; ret = 0;
out: out:
btrfs_release_path(root, path); btrfs_release_path(path);
return ret; return ret;
} }
...@@ -1428,8 +1428,8 @@ static noinline int check_item_in_log(struct btrfs_trans_handle *trans, ...@@ -1428,8 +1428,8 @@ static noinline int check_item_in_log(struct btrfs_trans_handle *trans,
} }
if (IS_ERR_OR_NULL(log_di)) { if (IS_ERR_OR_NULL(log_di)) {
btrfs_dir_item_key_to_cpu(eb, di, &location); btrfs_dir_item_key_to_cpu(eb, di, &location);
btrfs_release_path(root, path); btrfs_release_path(path);
btrfs_release_path(log, log_path); btrfs_release_path(log_path);
inode = read_one_inode(root, location.objectid); inode = read_one_inode(root, location.objectid);
BUG_ON(!inode); BUG_ON(!inode);
...@@ -1453,7 +1453,7 @@ static noinline int check_item_in_log(struct btrfs_trans_handle *trans, ...@@ -1453,7 +1453,7 @@ static noinline int check_item_in_log(struct btrfs_trans_handle *trans,
ret = 0; ret = 0;
goto out; goto out;
} }
btrfs_release_path(log, log_path); btrfs_release_path(log_path);
kfree(name); kfree(name);
ptr = (unsigned long)(di + 1); ptr = (unsigned long)(di + 1);
...@@ -1461,8 +1461,8 @@ static noinline int check_item_in_log(struct btrfs_trans_handle *trans, ...@@ -1461,8 +1461,8 @@ static noinline int check_item_in_log(struct btrfs_trans_handle *trans,
} }
ret = 0; ret = 0;
out: out:
btrfs_release_path(root, path); btrfs_release_path(path);
btrfs_release_path(log, log_path); btrfs_release_path(log_path);
return ret; return ret;
} }
...@@ -1550,7 +1550,7 @@ static noinline int replay_dir_deletes(struct btrfs_trans_handle *trans, ...@@ -1550,7 +1550,7 @@ static noinline int replay_dir_deletes(struct btrfs_trans_handle *trans,
break; break;
dir_key.offset = found_key.offset + 1; dir_key.offset = found_key.offset + 1;
} }
btrfs_release_path(root, path); btrfs_release_path(path);
if (range_end == (u64)-1) if (range_end == (u64)-1)
break; break;
range_start = range_end + 1; range_start = range_end + 1;
...@@ -1561,11 +1561,11 @@ static noinline int replay_dir_deletes(struct btrfs_trans_handle *trans, ...@@ -1561,11 +1561,11 @@ static noinline int replay_dir_deletes(struct btrfs_trans_handle *trans,
if (key_type == BTRFS_DIR_LOG_ITEM_KEY) { if (key_type == BTRFS_DIR_LOG_ITEM_KEY) {
key_type = BTRFS_DIR_LOG_INDEX_KEY; key_type = BTRFS_DIR_LOG_INDEX_KEY;
dir_key.type = BTRFS_DIR_INDEX_KEY; dir_key.type = BTRFS_DIR_INDEX_KEY;
btrfs_release_path(root, path); btrfs_release_path(path);
goto again; goto again;
} }
out: out:
btrfs_release_path(root, path); btrfs_release_path(path);
btrfs_free_path(log_path); btrfs_free_path(log_path);
iput(dir); iput(dir);
return ret; return ret;
...@@ -2225,7 +2225,7 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans, ...@@ -2225,7 +2225,7 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
bytes_del += name_len; bytes_del += name_len;
BUG_ON(ret); BUG_ON(ret);
} }
btrfs_release_path(log, path); btrfs_release_path(path);
di = btrfs_lookup_dir_index_item(trans, log, path, dir->i_ino, di = btrfs_lookup_dir_index_item(trans, log, path, dir->i_ino,
index, name, name_len, -1); index, name, name_len, -1);
if (IS_ERR(di)) { if (IS_ERR(di)) {
...@@ -2247,7 +2247,7 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans, ...@@ -2247,7 +2247,7 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
key.objectid = dir->i_ino; key.objectid = dir->i_ino;
key.offset = 0; key.offset = 0;
key.type = BTRFS_INODE_ITEM_KEY; key.type = BTRFS_INODE_ITEM_KEY;
btrfs_release_path(log, path); btrfs_release_path(path);
ret = btrfs_search_slot(trans, log, &key, path, 0, 1); ret = btrfs_search_slot(trans, log, &key, path, 0, 1);
if (ret < 0) { if (ret < 0) {
...@@ -2269,7 +2269,7 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans, ...@@ -2269,7 +2269,7 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
btrfs_mark_buffer_dirty(path->nodes[0]); btrfs_mark_buffer_dirty(path->nodes[0]);
} else } else
ret = 0; ret = 0;
btrfs_release_path(log, path); btrfs_release_path(path);
} }
fail: fail:
btrfs_free_path(path); btrfs_free_path(path);
...@@ -2344,7 +2344,7 @@ static noinline int insert_dir_log_key(struct btrfs_trans_handle *trans, ...@@ -2344,7 +2344,7 @@ static noinline int insert_dir_log_key(struct btrfs_trans_handle *trans,
struct btrfs_dir_log_item); struct btrfs_dir_log_item);
btrfs_set_dir_log_end(path->nodes[0], item, last_offset); btrfs_set_dir_log_end(path->nodes[0], item, last_offset);
btrfs_mark_buffer_dirty(path->nodes[0]); btrfs_mark_buffer_dirty(path->nodes[0]);
btrfs_release_path(log, path); btrfs_release_path(path);
return 0; return 0;
} }
...@@ -2393,10 +2393,10 @@ static noinline int log_dir_items(struct btrfs_trans_handle *trans, ...@@ -2393,10 +2393,10 @@ static noinline int log_dir_items(struct btrfs_trans_handle *trans,
min_key.objectid = inode->i_ino; min_key.objectid = inode->i_ino;
min_key.type = key_type; min_key.type = key_type;
min_key.offset = (u64)-1; min_key.offset = (u64)-1;
btrfs_release_path(root, path); btrfs_release_path(path);
ret = btrfs_search_slot(NULL, root, &min_key, path, 0, 0); ret = btrfs_search_slot(NULL, root, &min_key, path, 0, 0);
if (ret < 0) { if (ret < 0) {
btrfs_release_path(root, path); btrfs_release_path(path);
return ret; return ret;
} }
ret = btrfs_previous_item(root, path, inode->i_ino, key_type); ret = btrfs_previous_item(root, path, inode->i_ino, key_type);
...@@ -2432,7 +2432,7 @@ static noinline int log_dir_items(struct btrfs_trans_handle *trans, ...@@ -2432,7 +2432,7 @@ static noinline int log_dir_items(struct btrfs_trans_handle *trans,
} }
} }
} }
btrfs_release_path(root, path); btrfs_release_path(path);
/* find the first key from this transaction again */ /* find the first key from this transaction again */
ret = btrfs_search_slot(NULL, root, &min_key, path, 0, 0); ret = btrfs_search_slot(NULL, root, &min_key, path, 0, 0);
...@@ -2490,8 +2490,8 @@ static noinline int log_dir_items(struct btrfs_trans_handle *trans, ...@@ -2490,8 +2490,8 @@ static noinline int log_dir_items(struct btrfs_trans_handle *trans,
} }
} }
done: done:
btrfs_release_path(root, path); btrfs_release_path(path);
btrfs_release_path(log, dst_path); btrfs_release_path(dst_path);
if (err == 0) { if (err == 0) {
*last_offset_ret = last_offset; *last_offset_ret = last_offset;
...@@ -2588,9 +2588,9 @@ static int drop_objectid_items(struct btrfs_trans_handle *trans, ...@@ -2588,9 +2588,9 @@ static int drop_objectid_items(struct btrfs_trans_handle *trans,
ret = btrfs_del_item(trans, log, path); ret = btrfs_del_item(trans, log, path);
BUG_ON(ret); BUG_ON(ret);
btrfs_release_path(log, path); btrfs_release_path(path);
} }
btrfs_release_path(log, path); btrfs_release_path(path);
return ret; return ret;
} }
...@@ -2696,7 +2696,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, ...@@ -2696,7 +2696,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
} }
btrfs_mark_buffer_dirty(dst_path->nodes[0]); btrfs_mark_buffer_dirty(dst_path->nodes[0]);
btrfs_release_path(log, dst_path); btrfs_release_path(dst_path);
kfree(ins_data); kfree(ins_data);
/* /*
...@@ -2845,7 +2845,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, ...@@ -2845,7 +2845,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
} }
ins_nr = 0; ins_nr = 0;
} }
btrfs_release_path(root, path); btrfs_release_path(path);
if (min_key.offset < (u64)-1) if (min_key.offset < (u64)-1)
min_key.offset++; min_key.offset++;
...@@ -2868,8 +2868,8 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, ...@@ -2868,8 +2868,8 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
} }
WARN_ON(ins_nr); WARN_ON(ins_nr);
if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) { if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) {
btrfs_release_path(root, path); btrfs_release_path(path);
btrfs_release_path(log, dst_path); btrfs_release_path(dst_path);
ret = log_directory_changes(trans, root, inode, path, dst_path); ret = log_directory_changes(trans, root, inode, path, dst_path);
if (ret) { if (ret) {
err = ret; err = ret;
...@@ -3136,7 +3136,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree) ...@@ -3136,7 +3136,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
} }
btrfs_item_key_to_cpu(path->nodes[0], &found_key, btrfs_item_key_to_cpu(path->nodes[0], &found_key,
path->slots[0]); path->slots[0]);
btrfs_release_path(log_root_tree, path); btrfs_release_path(path);
if (found_key.objectid != BTRFS_TREE_LOG_OBJECTID) if (found_key.objectid != BTRFS_TREE_LOG_OBJECTID)
break; break;
...@@ -3171,7 +3171,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree) ...@@ -3171,7 +3171,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
if (found_key.offset == 0) if (found_key.offset == 0)
break; break;
} }
btrfs_release_path(log_root_tree, path); btrfs_release_path(path);
/* step one is to pin it all, step two is to replay just inodes */ /* step one is to pin it all, step two is to replay just inodes */
if (wc.pin) { if (wc.pin) {
......
...@@ -1475,7 +1475,7 @@ static int btrfs_finish_sprout(struct btrfs_trans_handle *trans, ...@@ -1475,7 +1475,7 @@ static int btrfs_finish_sprout(struct btrfs_trans_handle *trans,
goto error; goto error;
leaf = path->nodes[0]; leaf = path->nodes[0];
btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
btrfs_release_path(root, path); btrfs_release_path(path);
continue; continue;
} }
...@@ -1947,7 +1947,7 @@ static int btrfs_relocate_sys_chunks(struct btrfs_root *root) ...@@ -1947,7 +1947,7 @@ static int btrfs_relocate_sys_chunks(struct btrfs_root *root)
chunk = btrfs_item_ptr(leaf, path->slots[0], chunk = btrfs_item_ptr(leaf, path->slots[0],
struct btrfs_chunk); struct btrfs_chunk);
chunk_type = btrfs_chunk_type(leaf, chunk); chunk_type = btrfs_chunk_type(leaf, chunk);
btrfs_release_path(chunk_root, path); btrfs_release_path(path);
if (chunk_type & BTRFS_BLOCK_GROUP_SYSTEM) { if (chunk_type & BTRFS_BLOCK_GROUP_SYSTEM) {
ret = btrfs_relocate_chunk(chunk_root, chunk_tree, ret = btrfs_relocate_chunk(chunk_root, chunk_tree,
...@@ -2065,7 +2065,7 @@ int btrfs_balance(struct btrfs_root *dev_root) ...@@ -2065,7 +2065,7 @@ int btrfs_balance(struct btrfs_root *dev_root)
if (found_key.offset == 0) if (found_key.offset == 0)
break; break;
btrfs_release_path(chunk_root, path); btrfs_release_path(path);
ret = btrfs_relocate_chunk(chunk_root, ret = btrfs_relocate_chunk(chunk_root,
chunk_root->root_key.objectid, chunk_root->root_key.objectid,
found_key.objectid, found_key.objectid,
...@@ -2137,7 +2137,7 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size) ...@@ -2137,7 +2137,7 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size)
goto done; goto done;
if (ret) { if (ret) {
ret = 0; ret = 0;
btrfs_release_path(root, path); btrfs_release_path(path);
break; break;
} }
...@@ -2146,7 +2146,7 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size) ...@@ -2146,7 +2146,7 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size)
btrfs_item_key_to_cpu(l, &key, path->slots[0]); btrfs_item_key_to_cpu(l, &key, path->slots[0]);
if (key.objectid != device->devid) { if (key.objectid != device->devid) {
btrfs_release_path(root, path); btrfs_release_path(path);
break; break;
} }
...@@ -2154,14 +2154,14 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size) ...@@ -2154,14 +2154,14 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size)
length = btrfs_dev_extent_length(l, dev_extent); length = btrfs_dev_extent_length(l, dev_extent);
if (key.offset + length <= new_size) { if (key.offset + length <= new_size) {
btrfs_release_path(root, path); btrfs_release_path(path);
break; break;
} }
chunk_tree = btrfs_dev_extent_chunk_tree(l, dev_extent); chunk_tree = btrfs_dev_extent_chunk_tree(l, dev_extent);
chunk_objectid = btrfs_dev_extent_chunk_objectid(l, dev_extent); chunk_objectid = btrfs_dev_extent_chunk_objectid(l, dev_extent);
chunk_offset = btrfs_dev_extent_chunk_offset(l, dev_extent); chunk_offset = btrfs_dev_extent_chunk_offset(l, dev_extent);
btrfs_release_path(root, path); btrfs_release_path(path);
ret = btrfs_relocate_chunk(root, chunk_tree, chunk_objectid, ret = btrfs_relocate_chunk(root, chunk_tree, chunk_objectid,
chunk_offset); chunk_offset);
...@@ -3813,7 +3813,7 @@ int btrfs_read_chunk_tree(struct btrfs_root *root) ...@@ -3813,7 +3813,7 @@ int btrfs_read_chunk_tree(struct btrfs_root *root)
} }
if (key.objectid == BTRFS_DEV_ITEMS_OBJECTID) { if (key.objectid == BTRFS_DEV_ITEMS_OBJECTID) {
key.objectid = 0; key.objectid = 0;
btrfs_release_path(root, path); btrfs_release_path(path);
goto again; goto again;
} }
ret = 0; ret = 0;
......
...@@ -120,13 +120,13 @@ static int do_setxattr(struct btrfs_trans_handle *trans, ...@@ -120,13 +120,13 @@ static int do_setxattr(struct btrfs_trans_handle *trans,
ret = btrfs_delete_one_dir_name(trans, root, path, di); ret = btrfs_delete_one_dir_name(trans, root, path, di);
BUG_ON(ret); BUG_ON(ret);
btrfs_release_path(root, path); btrfs_release_path(path);
/* if we don't have a value then we are removing the xattr */ /* if we don't have a value then we are removing the xattr */
if (!value) if (!value)
goto out; goto out;
} else { } else {
btrfs_release_path(root, path); btrfs_release_path(path);
if (flags & XATTR_REPLACE) { if (flags & XATTR_REPLACE) {
/* we couldn't find the attr to replace */ /* we couldn't find the attr to replace */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment