summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2024-04-03 23:28:45 +0300
committerDavid Sterba <dsterba@suse.com>2024-05-07 22:31:10 +0300
commit8325f41a564acf39f1251c0423e97eb73c85a56f (patch)
tree6897037082436464364ca6b3125fd70d931e769e /fs
parentd456c25dbb2385fa081e615793c797cbcd412724 (diff)
downloadlinux-8325f41a564acf39f1251c0423e97eb73c85a56f.tar.xz
btrfs: push extent lock down in submit_one_async_extent
We don't need to include the time we spend in the allocator under our extent lock protection, move it after the allocator and make sure we lock the extent in the error case to ensure we're not clearing these bits without the extent lock held. Reviewed-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/inode.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 549a5f327428..944877a363fa 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1179,7 +1179,6 @@ static void submit_one_async_extent(struct async_chunk *async_chunk,
goto done;
}
- lock_extent(io_tree, start, end, NULL);
ret = btrfs_reserve_extent(root, async_extent->ram_size,
async_extent->compressed_size,
async_extent->compressed_size,
@@ -1195,6 +1194,8 @@ static void submit_one_async_extent(struct async_chunk *async_chunk,
goto done;
}
+ lock_extent(io_tree, start, end, NULL);
+
/* Here we're doing allocation and writeback of the compressed pages */
em = create_io_em(inode, start,
async_extent->ram_size, /* len */