]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
btrfs: remove unlock_extent from run_delalloc_compressed
authorJosef Bacik <josef@toxicpanda.com>
Mon, 12 Feb 2024 21:59:43 +0000 (16:59 -0500)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 May 2024 19:31:09 +0000 (21:31 +0200)
Since we immediately unlock the extent range when we enter
run_delalloc_compressed() simply move the lock_extent() down to cover
cow_file_range() and then remove the unlock_extent() from
run_delalloc_compressed.

Reviewed-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c

index 7c4ebe061abb422976ef3fc5539895166a2c4602..5337b54148e336c6af81e95da01d4bf66b95a84f 100644 (file)
@@ -1642,7 +1642,6 @@ static bool run_delalloc_compressed(struct btrfs_inode *inode,
        if (!ctx)
                return false;
 
-       unlock_extent(&inode->io_tree, start, end, NULL);
        set_bit(BTRFS_INODE_HAS_ASYNC_EXTENT, &inode->runtime_flags);
 
        async_chunk = ctx->chunks;
@@ -2276,16 +2275,16 @@ int btrfs_run_delalloc_range(struct btrfs_inode *inode, struct page *locked_page
                goto out;
        }
 
-       /*
-        * We're unlocked by the different fill functions below.
-        */
-       lock_extent(&inode->io_tree, start, end, NULL);
-
        if (btrfs_inode_can_compress(inode) &&
            inode_need_compress(inode, start, end) &&
            run_delalloc_compressed(inode, locked_page, start, end, wbc))
                return 1;
 
+       /*
+        * We're unlocked by the different fill functions below.
+        */
+       lock_extent(&inode->io_tree, start, end, NULL);
+
        if (zoned)
                ret = run_delalloc_cow(inode, locked_page, start, end, wbc,
                                       true);