Commit 896d7c1a authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David Sterba

btrfs: also use kthread_associate_blkcg for uncompressible ranges

submit_one_async_extent needs to use submit_one_async_extent no matter
if the range it handles ends up beeing compressed or not as the deadlock
risk due to cgroup thottling is the same.  Call kthread_associate_blkcg
earlier to cover submit_uncompressed_range case as well.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent e43a6210
...@@ -983,6 +983,9 @@ static int submit_one_async_extent(struct btrfs_inode *inode, ...@@ -983,6 +983,9 @@ static int submit_one_async_extent(struct btrfs_inode *inode,
u64 start = async_extent->start; u64 start = async_extent->start;
u64 end = async_extent->start + async_extent->ram_size - 1; u64 end = async_extent->start + async_extent->ram_size - 1;
if (async_chunk->blkcg_css)
kthread_associate_blkcg(async_chunk->blkcg_css);
/* /*
* If async_chunk->locked_page is in the async_extent range, we need to * If async_chunk->locked_page is in the async_extent range, we need to
* handle it. * handle it.
...@@ -1053,8 +1056,6 @@ static int submit_one_async_extent(struct btrfs_inode *inode, ...@@ -1053,8 +1056,6 @@ static int submit_one_async_extent(struct btrfs_inode *inode,
NULL, EXTENT_LOCKED | EXTENT_DELALLOC, NULL, EXTENT_LOCKED | EXTENT_DELALLOC,
PAGE_UNLOCK | PAGE_START_WRITEBACK); PAGE_UNLOCK | PAGE_START_WRITEBACK);
if (async_chunk->blkcg_css)
kthread_associate_blkcg(async_chunk->blkcg_css);
btrfs_submit_compressed_write(inode, start, /* file_offset */ btrfs_submit_compressed_write(inode, start, /* file_offset */
async_extent->ram_size, /* num_bytes */ async_extent->ram_size, /* num_bytes */
ins.objectid, /* disk_bytenr */ ins.objectid, /* disk_bytenr */
...@@ -1062,10 +1063,10 @@ static int submit_one_async_extent(struct btrfs_inode *inode, ...@@ -1062,10 +1063,10 @@ static int submit_one_async_extent(struct btrfs_inode *inode,
async_extent->pages, /* compressed_pages */ async_extent->pages, /* compressed_pages */
async_extent->nr_pages, async_extent->nr_pages,
async_chunk->write_flags, true); async_chunk->write_flags, true);
if (async_chunk->blkcg_css)
kthread_associate_blkcg(NULL);
*alloc_hint = ins.objectid + ins.offset; *alloc_hint = ins.objectid + ins.offset;
done: done:
if (async_chunk->blkcg_css)
kthread_associate_blkcg(NULL);
kfree(async_extent); kfree(async_extent);
return ret; return ret;
......
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