summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2025-09-01 12:43:42 +0100
committerDavid Sterba <dsterba@suse.com>2025-09-23 08:49:20 +0200
commit29d9c5e0370593cec8298601ab3e9ce29799fb6f (patch)
tree4abc8a46bd27cb2af24427afb0482f0e4cfe48df
parent2ac70946621ff3d90eb84d2e3b74563f4154f24c (diff)
btrfs: avoid unnecessary path allocation at fixup_inode_link_count()
There's no need to allocate a path as our single caller already has a path that we can use. So pass the caller's path and use it. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/tree-log.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index b4e901da9e8b..5754333ae732 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1728,19 +1728,15 @@ process_slot:
* will free the inode.
*/
static noinline int fixup_inode_link_count(struct walk_control *wc,
+ struct btrfs_path *path,
struct btrfs_inode *inode)
{
struct btrfs_trans_handle *trans = wc->trans;
struct btrfs_root *root = inode->root;
- struct btrfs_path *path;
int ret;
u64 nlink = 0;
const u64 ino = btrfs_ino(inode);
- path = btrfs_alloc_path();
- if (!path)
- return -ENOMEM;
-
ret = count_inode_refs(inode, path);
if (ret < 0)
goto out;
@@ -1776,7 +1772,7 @@ static noinline int fixup_inode_link_count(struct walk_control *wc,
}
out:
- btrfs_free_path(path);
+ btrfs_release_path(path);
return ret;
}
@@ -1821,7 +1817,7 @@ static noinline int fixup_inode_link_counts(struct walk_control *wc,
break;
}
- ret = fixup_inode_link_count(wc, inode);
+ ret = fixup_inode_link_count(wc, path, inode);
iput(&inode->vfs_inode);
if (ret)
break;