aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2019-03-12 17:20:30 +0200
committerDavid Sterba <dsterba@suse.com>2019-05-02 13:48:19 +0200
commit7447555fe7765d7823f5db7760bfdeba035b7bad (patch)
treea390453fc43d1788dacce25bbdf885192832d580 /fs
parentbtrfs: Set io_tree only once in submit_compressed_extents (diff)
downloadlinux-dev-7447555fe7765d7823f5db7760bfdeba035b7bad.tar.xz
linux-dev-7447555fe7765d7823f5db7760bfdeba035b7bad.zip
btrfs: Factor out common extent locking code in submit_compressed_extents
Irrespective of whether the compress code fell back to uncompressed or a compressed extent has to be submitted, the extent range is always locked. So factor out the common lock_extent call at the beginning of the loop. No functional changes just removes one duplicate lock_extent call. Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/inode.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 83bf10bb13bb..05ff09e8a200 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -725,16 +725,15 @@ again:
async_extent = list_entry(async_chunk->extents.next,
struct async_extent, list);
list_del(&async_extent->list);
+
retry:
+ lock_extent(io_tree, async_extent->start,
+ async_extent->start + async_extent->ram_size - 1);
/* did the compression code fall back to uncompressed IO? */
if (!async_extent->pages) {
int page_started = 0;
unsigned long nr_written = 0;
- lock_extent(io_tree, async_extent->start,
- async_extent->start +
- async_extent->ram_size - 1);
-
/* allocate blocks */
ret = cow_file_range(inode, async_chunk->locked_page,
async_extent->start,
@@ -766,9 +765,6 @@ retry:
continue;
}
- lock_extent(io_tree, async_extent->start,
- async_extent->start + async_extent->ram_size - 1);
-
ret = btrfs_reserve_extent(root, async_extent->ram_size,
async_extent->compressed_size,
async_extent->compressed_size,