]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
btrfs: Move free_pages_out label in inline extent handling branch in compress_file_range
authorNikolay Borisov <nborisov@suse.com>
Wed, 17 Jul 2019 11:41:45 +0000 (14:41 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Aug 2020 08:29:54 +0000 (10:29 +0200)
[ Upstream commit cecc8d9038d164eda61fbcd72520975a554ea63e ]

This label is only executed if compress_file_range fails to create an
inline extent. So move its code in the semantically related inline
extent handling branch. No functional changes.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/inode.c

index 57908ee964a20d4d1ce64108f7fc70c51586ba65..dc520749f51db19323d7120d61c10eb2294f3fca 100644 (file)
@@ -629,7 +629,14 @@ cont:
                                btrfs_free_reserved_data_space_noquota(inode,
                                                               start,
                                                               end - start + 1);
-                       goto free_pages_out;
+
+                       for (i = 0; i < nr_pages; i++) {
+                               WARN_ON(pages[i]->mapping);
+                               put_page(pages[i]);
+                       }
+                       kfree(pages);
+
+                       return;
                }
        }
 
@@ -708,13 +715,6 @@ cleanup_and_bail_uncompressed:
        *num_added += 1;
 
        return;
-
-free_pages_out:
-       for (i = 0; i < nr_pages; i++) {
-               WARN_ON(pages[i]->mapping);
-               put_page(pages[i]);
-       }
-       kfree(pages);
 }
 
 static void free_async_extent_pages(struct async_extent *async_extent)