]> www.infradead.org Git - users/hch/misc.git/commitdiff
btrfs: avoid unnecessary path allocation when replaying a dir item
authorFilipe Manana <fdmanana@suse.com>
Mon, 1 Sep 2025 15:37:05 +0000 (16:37 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 23 Sep 2025 06:49:20 +0000 (08:49 +0200)
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>
fs/btrfs/tree-log.c

index a912ccdf14855c3b527125bbf0c4f0c533b38dfb..de1f1c024dc0f9ed9e7d48dd7227a0d6453f79e4 100644 (file)
@@ -2147,18 +2147,10 @@ static noinline int replay_one_dir_item(struct walk_control *wc,
         * dentries that can never be deleted.
         */
        if (ret == 1 && btrfs_dir_ftype(wc->log_leaf, di) != BTRFS_FT_DIR) {
-               struct btrfs_path *fixup_path;
                struct btrfs_key di_key;
 
-               fixup_path = btrfs_alloc_path();
-               if (!fixup_path) {
-                       btrfs_abort_transaction(wc->trans, -ENOMEM);
-                       return -ENOMEM;
-               }
-
                btrfs_dir_item_key_to_cpu(wc->log_leaf, di, &di_key);
-               ret = link_to_fixup_dir(wc, fixup_path, di_key.objectid);
-               btrfs_free_path(fixup_path);
+               ret = link_to_fixup_dir(wc, path, di_key.objectid);
        }
 
        return ret;