Skip to content

Commit f366722

Browse files
fdmananakdave
authored andcommitted
btrfs: avoid unnecessary path allocation when replaying a dir item
There's no need to allocate 'fixup_path' at replay_one_dir_item(), as the path passed as an argument is unused by the time link_to_fixup_dir() is called (replay_one_name() releases the path before it returns). Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent b343047 commit f366722

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

fs/btrfs/tree-log.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,18 +2147,10 @@ static noinline int replay_one_dir_item(struct walk_control *wc,
21472147
* dentries that can never be deleted.
21482148
*/
21492149
if (ret == 1 && btrfs_dir_ftype(wc->log_leaf, di) != BTRFS_FT_DIR) {
2150-
struct btrfs_path *fixup_path;
21512150
struct btrfs_key di_key;
21522151

2153-
fixup_path = btrfs_alloc_path();
2154-
if (!fixup_path) {
2155-
btrfs_abort_transaction(wc->trans, -ENOMEM);
2156-
return -ENOMEM;
2157-
}
2158-
21592152
btrfs_dir_item_key_to_cpu(wc->log_leaf, di, &di_key);
2160-
ret = link_to_fixup_dir(wc, fixup_path, di_key.objectid);
2161-
btrfs_free_path(fixup_path);
2153+
ret = link_to_fixup_dir(wc, path, di_key.objectid);
21622154
}
21632155

21642156
return ret;

0 commit comments

Comments
 (0)