Skip to content

Commit acee08a

Browse files
dennisszhoukdave
authored andcommitted
btrfs: fix btrfs_submit_compressed_write cgroup attribution
This restores the logic from commit 46bcff2 ("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: 9150724 ("btrfs: determine stripe boundary at bio allocation time in btrfs_submit_compressed_write") CC: [email protected] # 5.16+ Signed-off-by: Dennis Zhou <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 168a2f7 commit acee08a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

fs/btrfs/compression.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,9 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start,
537537
cb->orig_bio = NULL;
538538
cb->nr_pages = nr_pages;
539539

540+
if (blkcg_css)
541+
kthread_associate_blkcg(blkcg_css);
542+
540543
while (cur_disk_bytenr < disk_start + compressed_len) {
541544
u64 offset = cur_disk_bytenr - disk_start;
542545
unsigned int index = offset >> PAGE_SHIFT;
@@ -555,6 +558,8 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start,
555558
bio = NULL;
556559
goto finish_cb;
557560
}
561+
if (blkcg_css)
562+
bio->bi_opf |= REQ_CGROUP_PUNT;
558563
}
559564
/*
560565
* 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,
612617
return 0;
613618

614619
finish_cb:
620+
if (blkcg_css)
621+
kthread_associate_blkcg(NULL);
622+
615623
if (bio) {
616624
bio->bi_status = ret;
617625
bio_endio(bio);

0 commit comments

Comments
 (0)