diff options
author | Filipe Manana <fdmanana@suse.com> | 2022-03-23 16:19:26 +0000 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-05-16 17:03:10 +0200 |
commit | 1a89f1738684cac05b4bbea80dd77e8f15176d3a (patch) | |
tree | 7ccdf8499a44a93d031e62034678253065189b0f /fs/btrfs/extent-tree.c | |
parent | d7a8ab4e9b889de6daddbb674460e42b86d5dccf (diff) | |
download | lwn-1a89f1738684cac05b4bbea80dd77e8f15176d3a.tar.gz lwn-1a89f1738684cac05b4bbea80dd77e8f15176d3a.zip |
btrfs: stop allocating a path when checking if cross reference exists
At btrfs_cross_ref_exist() we always allocate a path, but we really don't
need to because all its callers (only 2) already have an allocated path
that is not being used when they call btrfs_cross_ref_exist(). So change
btrfs_cross_ref_exist() to take a path as an argument and update both
its callers to pass in the unused path they have when they call
btrfs_cross_ref_exist().
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 6aa92f84f465..fc5b9be06ec8 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -2357,15 +2357,10 @@ out: } int btrfs_cross_ref_exist(struct btrfs_root *root, u64 objectid, u64 offset, - u64 bytenr, bool strict) + u64 bytenr, bool strict, struct btrfs_path *path) { - struct btrfs_path *path; int ret; - path = btrfs_alloc_path(); - if (!path) - return -ENOMEM; - do { ret = check_committed_ref(root, path, objectid, offset, bytenr, strict); @@ -2376,7 +2371,7 @@ int btrfs_cross_ref_exist(struct btrfs_root *root, u64 objectid, u64 offset, } while (ret == -EAGAIN); out: - btrfs_free_path(path); + btrfs_release_path(path); if (btrfs_is_data_reloc_root(root)) WARN_ON(ret > 0); return ret; |