Also remove unused path in extent-tree.c:finish_current_insert().

Signed-off-by: Filipe David Borba Manana <fdman...@gmail.com>
---

V2: added 1 more path alloc check and removed unnecessary path
    allocation in extent-tree.c:finish_current_insert().

 extent-tree.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/extent-tree.c b/extent-tree.c
index f597e16..e4adaa3 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -1487,6 +1487,8 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle 
*trans,
        }
 
        path = btrfs_alloc_path();
+       if (!path)
+               return -ENOMEM;
        path->reada = 1;
 
        key.objectid = bytenr;
@@ -1577,6 +1579,8 @@ int btrfs_set_block_flags(struct btrfs_trans_handle 
*trans,
                                  BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA);
 
        path = btrfs_alloc_path();
+       if (!path)
+               return -ENOMEM;
        path->reada = 1;
 
        key.objectid = bytenr;
@@ -2078,7 +2082,6 @@ static int finish_current_insert(struct 
btrfs_trans_handle *trans,
        u64 end;
        u64 priv;
        struct btrfs_fs_info *info = extent_root->fs_info;
-       struct btrfs_path *path;
        struct pending_extent_op *extent_op;
        struct btrfs_key key;
        int ret;
@@ -2086,8 +2089,6 @@ static int finish_current_insert(struct 
btrfs_trans_handle *trans,
                btrfs_fs_incompat(extent_root->fs_info,
                                  BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA);
 
-       path = btrfs_alloc_path();
-
        while(1) {
                ret = find_first_extent_bit(&info->extent_ins, 0, &start,
                                            &end, EXTENT_LOCKED);
@@ -2121,7 +2122,6 @@ static int finish_current_insert(struct 
btrfs_trans_handle *trans,
                                  GFP_NOFS);
                kfree(extent_op);
        }
-       btrfs_free_path(path);
        return 0;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to