Commit 8325f41a authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

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: default avatarGoldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent d456c25d
...@@ -1179,7 +1179,6 @@ static void submit_one_async_extent(struct async_chunk *async_chunk, ...@@ -1179,7 +1179,6 @@ static void submit_one_async_extent(struct async_chunk *async_chunk,
goto done; goto done;
} }
lock_extent(io_tree, start, end, NULL);
ret = btrfs_reserve_extent(root, async_extent->ram_size, ret = btrfs_reserve_extent(root, async_extent->ram_size,
async_extent->compressed_size, async_extent->compressed_size,
async_extent->compressed_size, async_extent->compressed_size,
...@@ -1195,6 +1194,8 @@ static void submit_one_async_extent(struct async_chunk *async_chunk, ...@@ -1195,6 +1194,8 @@ static void submit_one_async_extent(struct async_chunk *async_chunk,
goto done; goto done;
} }
lock_extent(io_tree, start, end, NULL);
/* Here we're doing allocation and writeback of the compressed pages */ /* Here we're doing allocation and writeback of the compressed pages */
em = create_io_em(inode, start, em = create_io_em(inode, start,
async_extent->ram_size, /* len */ async_extent->ram_size, /* len */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment