Commit adfb5fb4 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong

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: default avatarStefan Priebe - Profihost AG <s.priebe@profihost.ag>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent a2473735
...@@ -700,6 +700,7 @@ xfs_alloc_ioend( ...@@ -700,6 +700,7 @@ xfs_alloc_ioend(
bio->bi_iter.bi_sector = sector; bio->bi_iter.bi_sector = sector;
bio->bi_opf = REQ_OP_WRITE | wbc_to_write_flags(wbc); bio->bi_opf = REQ_OP_WRITE | wbc_to_write_flags(wbc);
bio->bi_write_hint = inode->i_write_hint; bio->bi_write_hint = inode->i_write_hint;
wbc_init_bio(wbc, bio);
ioend = container_of(bio, struct xfs_ioend, io_inline_bio); ioend = container_of(bio, struct xfs_ioend, io_inline_bio);
INIT_LIST_HEAD(&ioend->io_list); INIT_LIST_HEAD(&ioend->io_list);
...@@ -727,7 +728,7 @@ xfs_chain_bio( ...@@ -727,7 +728,7 @@ xfs_chain_bio(
struct bio *new; struct bio *new;
new = bio_alloc(GFP_NOFS, BIO_MAX_PAGES); new = bio_alloc(GFP_NOFS, BIO_MAX_PAGES);
bio_copy_dev(new, prev); bio_copy_dev(new, prev);/* also copies over blkcg information */
new->bi_iter.bi_sector = bio_end_sector(prev); new->bi_iter.bi_sector = bio_end_sector(prev);
new->bi_opf = prev->bi_opf; new->bi_opf = prev->bi_opf;
new->bi_write_hint = prev->bi_write_hint; new->bi_write_hint = prev->bi_write_hint;
...@@ -782,6 +783,7 @@ xfs_add_to_ioend( ...@@ -782,6 +783,7 @@ xfs_add_to_ioend(
} }
wpc->ioend->io_size += len; wpc->ioend->io_size += len;
wbc_account_io(wbc, page, len);
} }
STATIC void STATIC void
......
...@@ -1676,6 +1676,8 @@ xfs_fs_fill_super( ...@@ -1676,6 +1676,8 @@ xfs_fs_fill_super(
sb->s_maxbytes = xfs_max_file_offset(sb->s_blocksize_bits); sb->s_maxbytes = xfs_max_file_offset(sb->s_blocksize_bits);
sb->s_max_links = XFS_MAXLINK; sb->s_max_links = XFS_MAXLINK;
sb->s_time_gran = 1; sb->s_time_gran = 1;
sb->s_iflags |= SB_I_CGROUPWB;
set_posix_acl_flag(sb); set_posix_acl_flag(sb);
/* version 5 superblocks support inode version counters. */ /* version 5 superblocks support inode version counters. */
......
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