summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-06-28 22:30:22 -0400
committerDarrick J. Wong <darrick.wong@oracle.com>2019-06-28 22:30:22 -0400
commitadfb5fb46af059387eca0fce1d8cd8733f9ee3a0 (patch)
tree7bb34bbb28698eeb8c7e9ab37114dd1e81045a51
parenta247373596677bd38a88fcaf1606be51a44c614d (diff)
xfs: implement cgroup aware writeback
Link every newly allocated writeback bio to cgroup pointed to by the writeback control structure, and charge every byte written back to it. Tested-by: Stefan Priebe - Profihost AG <s.priebe@profihost.ag> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-rw-r--r--fs/xfs/xfs_aops.c4
-rw-r--r--fs/xfs/xfs_super.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 9cceb90e77c5..73c291aeae17 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -700,6 +700,7 @@ xfs_alloc_ioend(
700 bio->bi_iter.bi_sector = sector; 700 bio->bi_iter.bi_sector = sector;
701 bio->bi_opf = REQ_OP_WRITE | wbc_to_write_flags(wbc); 701 bio->bi_opf = REQ_OP_WRITE | wbc_to_write_flags(wbc);
702 bio->bi_write_hint = inode->i_write_hint; 702 bio->bi_write_hint = inode->i_write_hint;
703 wbc_init_bio(wbc, bio);
703 704
704 ioend = container_of(bio, struct xfs_ioend, io_inline_bio); 705 ioend = container_of(bio, struct xfs_ioend, io_inline_bio);
705 INIT_LIST_HEAD(&ioend->io_list); 706 INIT_LIST_HEAD(&ioend->io_list);
@@ -727,7 +728,7 @@ xfs_chain_bio(
727 struct bio *new; 728 struct bio *new;
728 729
729 new = bio_alloc(GFP_NOFS, BIO_MAX_PAGES); 730 new = bio_alloc(GFP_NOFS, BIO_MAX_PAGES);
730 bio_copy_dev(new, prev); 731 bio_copy_dev(new, prev);/* also copies over blkcg information */
731 new->bi_iter.bi_sector = bio_end_sector(prev); 732 new->bi_iter.bi_sector = bio_end_sector(prev);
732 new->bi_opf = prev->bi_opf; 733 new->bi_opf = prev->bi_opf;
733 new->bi_write_hint = prev->bi_write_hint; 734 new->bi_write_hint = prev->bi_write_hint;
@@ -782,6 +783,7 @@ xfs_add_to_ioend(
782 } 783 }
783 784
784 wpc->ioend->io_size += len; 785 wpc->ioend->io_size += len;
786 wbc_account_io(wbc, page, len);
785} 787}
786 788
787STATIC void 789STATIC void
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 5c28fb22b44b..94fd0a6e3842 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1676,6 +1676,8 @@ xfs_fs_fill_super(
1676 sb->s_maxbytes = xfs_max_file_offset(sb->s_blocksize_bits); 1676 sb->s_maxbytes = xfs_max_file_offset(sb->s_blocksize_bits);
1677 sb->s_max_links = XFS_MAXLINK; 1677 sb->s_max_links = XFS_MAXLINK;
1678 sb->s_time_gran = 1; 1678 sb->s_time_gran = 1;
1679 sb->s_iflags |= SB_I_CGROUPWB;
1680
1679 set_posix_acl_flag(sb); 1681 set_posix_acl_flag(sb);
1680 1682
1681 /* version 5 superblocks support inode version counters. */ 1683 /* version 5 superblocks support inode version counters. */