aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/page-io.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2015-07-21 23:51:26 -0400
committerTheodore Ts'o <tytso@mit.edu>2015-07-21 23:51:26 -0400
commit001e4a8775f6e8ad52a89e0072f09aee47d5d252 (patch)
tree2f00fa365f33cb3e619be66df86c05865567f88f /fs/ext4/page-io.c
parent5a33911fa5ecd7395115df2e27fbd22b73357ac5 (diff)
ext4: implement cgroup writeback support
For ordered and writeback data modes, all data IOs go through ext4_io_submit. This patch adds cgroup writeback support by invoking wbc_init_bio() from io_submit_init_bio() and wbc_account_io() in io_submit_add_bh(). Journal data which is written by jbd2 worker is left alone by this patch and will always be written out from the root cgroup. ext4_fill_super() is updated to set MS_CGROUPWB when data mode is either ordered or writeback. In journaled data mode, most IOs become synchronous through the journal and enabling cgroup writeback support doesn't make much sense or difference. Journaled data mode is left alone. Lightly tested with sequential data write workload. Behaves as expected. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/page-io.c')
-rw-r--r--fs/ext4/page-io.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
index a917bfe3e70c..58ab2e3dd114 100644
--- a/fs/ext4/page-io.c
+++ b/fs/ext4/page-io.c
@@ -383,6 +383,7 @@ static int io_submit_init_bio(struct ext4_io_submit *io,
383 bio = bio_alloc(GFP_NOIO, min(nvecs, BIO_MAX_PAGES)); 383 bio = bio_alloc(GFP_NOIO, min(nvecs, BIO_MAX_PAGES));
384 if (!bio) 384 if (!bio)
385 return -ENOMEM; 385 return -ENOMEM;
386 wbc_init_bio(io->io_wbc, bio);
386 bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9); 387 bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9);
387 bio->bi_bdev = bh->b_bdev; 388 bio->bi_bdev = bh->b_bdev;
388 bio->bi_end_io = ext4_end_bio; 389 bio->bi_end_io = ext4_end_bio;
@@ -411,6 +412,7 @@ submit_and_retry:
411 ret = bio_add_page(io->io_bio, page, bh->b_size, bh_offset(bh)); 412 ret = bio_add_page(io->io_bio, page, bh->b_size, bh_offset(bh));
412 if (ret != bh->b_size) 413 if (ret != bh->b_size)
413 goto submit_and_retry; 414 goto submit_and_retry;
415 wbc_account_io(io->io_wbc, page, bh->b_size);
414 io->io_next_block++; 416 io->io_next_block++;
415 return 0; 417 return 0;
416} 418}