summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-11-03 00:37:51 +0100
committerDavid Sterba <dsterba@suse.com>2016-11-09 13:47:32 +0100
commit29bfb8318bbe2bfb6c3c3faf1b7f79ed6fe534ea (patch)
treea6e534482185c6d1e129284690c1abeb0d607c2c
parentd0c3fa4d5b497dd41dee9e9e9549772a46be5d31 (diff)
btrfs-progs: check: use on-stack path buffer in recow_extent_buffer
We don't need to conserve stack space too much unlike kernel, also remove one error condition. Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--cmds-check.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/cmds-check.c b/cmds-check.c
index 16a818bd..45ad20bb 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -10471,7 +10471,7 @@ static int reinit_extent_tree(struct btrfs_trans_handle *trans,
static int recow_extent_buffer(struct btrfs_root *root, struct extent_buffer *eb)
{
- struct btrfs_path *path;
+ struct btrfs_path path;
struct btrfs_trans_handle *trans;
struct btrfs_key key;
int ret;
@@ -10488,25 +10488,20 @@ static int recow_extent_buffer(struct btrfs_root *root, struct extent_buffer *eb
return PTR_ERR(root);
}
- path = btrfs_alloc_path();
- if (!path)
- return -ENOMEM;
-
trans = btrfs_start_transaction(root, 1);
- if (IS_ERR(trans)) {
- btrfs_free_path(path);
+ if (IS_ERR(trans))
return PTR_ERR(trans);
- }
- path->lowest_level = btrfs_header_level(eb);
- if (path->lowest_level)
+ btrfs_init_path(&path);
+ path.lowest_level = btrfs_header_level(eb);
+ if (path.lowest_level)
btrfs_node_key_to_cpu(eb, &key, 0);
else
btrfs_item_key_to_cpu(eb, &key, 0);
- ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
+ ret = btrfs_search_slot(trans, root, &key, &path, 0, 1);
btrfs_commit_transaction(trans, root);
- btrfs_free_path(path);
+ btrfs_release_path(&path);
return ret;
}