btrfs: fix btrfs_submit_compressed_write cgroup attribution
This restores the logic from commit46bcff2bfc("btrfs: fix compressed write bio blkcg attribution") which added cgroup attribution to btrfs writeback. It also adds back the REQ_CGROUP_PUNT flag for these ios. Fixes:9150724048("btrfs: determine stripe boundary at bio allocation time in btrfs_submit_compressed_write") CC: stable@vger.kernel.org # 5.16+ Signed-off-by: Dennis Zhou <dennis@kernel.org> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
committed by
David Sterba
parent
168a2f776b
commit
acee08aaf6
@@ -537,6 +537,9 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start,
|
|||||||
cb->orig_bio = NULL;
|
cb->orig_bio = NULL;
|
||||||
cb->nr_pages = nr_pages;
|
cb->nr_pages = nr_pages;
|
||||||
|
|
||||||
|
if (blkcg_css)
|
||||||
|
kthread_associate_blkcg(blkcg_css);
|
||||||
|
|
||||||
while (cur_disk_bytenr < disk_start + compressed_len) {
|
while (cur_disk_bytenr < disk_start + compressed_len) {
|
||||||
u64 offset = cur_disk_bytenr - disk_start;
|
u64 offset = cur_disk_bytenr - disk_start;
|
||||||
unsigned int index = offset >> PAGE_SHIFT;
|
unsigned int index = offset >> PAGE_SHIFT;
|
||||||
@@ -555,6 +558,8 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start,
|
|||||||
bio = NULL;
|
bio = NULL;
|
||||||
goto finish_cb;
|
goto finish_cb;
|
||||||
}
|
}
|
||||||
|
if (blkcg_css)
|
||||||
|
bio->bi_opf |= REQ_CGROUP_PUNT;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* We should never reach next_stripe_start start as we will
|
* We should never reach next_stripe_start start as we will
|
||||||
@@ -612,6 +617,9 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
finish_cb:
|
finish_cb:
|
||||||
|
if (blkcg_css)
|
||||||
|
kthread_associate_blkcg(NULL);
|
||||||
|
|
||||||
if (bio) {
|
if (bio) {
|
||||||
bio->bi_status = ret;
|
bio->bi_status = ret;
|
||||||
bio_endio(bio);
|
bio_endio(bio);
|
||||||
|
|||||||
Reference in New Issue
Block a user