diff options
author | David Sterba <dsterba@suse.com> | 2016-11-03 00:37:51 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-11-09 13:47:33 +0100 |
commit | 02ca1e8a0f93f64edbebd9ca43877fd139f25982 (patch) | |
tree | 73a22bb38bcf4e88d6601d6cd6b3333e0b86e358 | |
parent | c050db55e2ce76d40b025ca0ef4e88d9f8041dc5 (diff) |
btrfs-progs: check: use on-stack path buffer in fill_csum_tree_from_fs
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.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/cmds-check.c b/cmds-check.c index dbfd2b4d..be4ca79e 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -10650,7 +10650,7 @@ static int fill_csum_tree_from_fs(struct btrfs_trans_handle *trans, struct btrfs_root *csum_root) { struct btrfs_fs_info *fs_info = csum_root->fs_info; - struct btrfs_path *path; + struct btrfs_path path; struct btrfs_root *tree_root = fs_info->tree_root; struct btrfs_root *cur_root; struct extent_buffer *node; @@ -10658,15 +10658,11 @@ static int fill_csum_tree_from_fs(struct btrfs_trans_handle *trans, int slot = 0; int ret = 0; - path = btrfs_alloc_path(); - if (!path) - return -ENOMEM; - + btrfs_init_path(&path); key.objectid = BTRFS_FS_TREE_OBJECTID; key.offset = 0; key.type = BTRFS_ROOT_ITEM_KEY; - - ret = btrfs_search_slot(NULL, tree_root, &key, path, 0, 0); + ret = btrfs_search_slot(NULL, tree_root, &key, &path, 0, 0); if (ret < 0) goto out; if (ret > 0) { @@ -10675,8 +10671,8 @@ static int fill_csum_tree_from_fs(struct btrfs_trans_handle *trans, } while (1) { - node = path->nodes[0]; - slot = path->slots[0]; + node = path.nodes[0]; + slot = path.slots[0]; btrfs_item_key_to_cpu(node, &key, slot); if (key.objectid > BTRFS_LAST_FREE_OBJECTID) goto out; @@ -10697,7 +10693,7 @@ static int fill_csum_tree_from_fs(struct btrfs_trans_handle *trans, if (ret < 0) goto out; next: - ret = btrfs_next_item(tree_root, path); + ret = btrfs_next_item(tree_root, &path); if (ret > 0) { ret = 0; goto out; @@ -10707,7 +10703,7 @@ next: } out: - btrfs_free_path(path); + btrfs_release_path(&path); return ret; } |