1 Move setting up operation and write hint to xfs_alloc_ioend, and
\r
2 then just copy over all needed information from the previous bio
\r
3 in xfs_chain_bio and stop passing various parameters to it.
\r
5 Signed-off-by: Christoph Hellwig <hch@lst.de>
\r
7 fs/xfs/xfs_aops.c | 35 +++++++++++++++++------------------
\r
8 1 file changed, 17 insertions(+), 18 deletions(-)
\r
10 diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
\r
11 index a6f0f4761a37..9cceb90e77c5 100644
\r
12 --- a/fs/xfs/xfs_aops.c
\r
13 +++ b/fs/xfs/xfs_aops.c
\r
14 @@ -665,7 +665,6 @@ xfs_submit_ioend(
\r
16 ioend->io_bio->bi_private = ioend;
\r
17 ioend->io_bio->bi_end_io = xfs_end_bio;
\r
18 - ioend->io_bio->bi_opf = REQ_OP_WRITE | wbc_to_write_flags(wbc);
\r
21 * If we are failing the IO now, just mark the ioend with an
\r
22 @@ -679,7 +678,6 @@ xfs_submit_ioend(
\r
26 - ioend->io_bio->bi_write_hint = ioend->io_inode->i_write_hint;
\r
27 submit_bio(ioend->io_bio);
\r
30 @@ -691,7 +689,8 @@ xfs_alloc_ioend(
\r
33 struct block_device *bdev,
\r
36 + struct writeback_control *wbc)
\r
38 struct xfs_ioend *ioend;
\r
40 @@ -699,6 +698,8 @@ xfs_alloc_ioend(
\r
41 bio = bio_alloc_bioset(GFP_NOFS, BIO_MAX_PAGES, &xfs_ioend_bioset);
\r
42 bio_set_dev(bio, bdev);
\r
43 bio->bi_iter.bi_sector = sector;
\r
44 + bio->bi_opf = REQ_OP_WRITE | wbc_to_write_flags(wbc);
\r
45 + bio->bi_write_hint = inode->i_write_hint;
\r
47 ioend = container_of(bio, struct xfs_ioend, io_inline_bio);
\r
48 INIT_LIST_HEAD(&ioend->io_list);
\r
49 @@ -719,24 +720,22 @@ xfs_alloc_ioend(
\r
50 * so that the bi_private linkage is set up in the right direction for the
\r
51 * traversal in xfs_destroy_ioend().
\r
54 +static struct bio *
\r
56 - struct xfs_ioend *ioend,
\r
57 - struct writeback_control *wbc,
\r
58 - struct block_device *bdev,
\r
64 new = bio_alloc(GFP_NOFS, BIO_MAX_PAGES);
\r
65 - bio_set_dev(new, bdev);
\r
66 - new->bi_iter.bi_sector = sector;
\r
67 - bio_chain(ioend->io_bio, new);
\r
68 - bio_get(ioend->io_bio); /* for xfs_destroy_ioend */
\r
69 - ioend->io_bio->bi_opf = REQ_OP_WRITE | wbc_to_write_flags(wbc);
\r
70 - ioend->io_bio->bi_write_hint = ioend->io_inode->i_write_hint;
\r
71 - submit_bio(ioend->io_bio);
\r
72 - ioend->io_bio = new;
\r
73 + bio_copy_dev(new, prev);
\r
74 + new->bi_iter.bi_sector = bio_end_sector(prev);
\r
75 + new->bi_opf = prev->bi_opf;
\r
76 + new->bi_write_hint = prev->bi_write_hint;
\r
78 + bio_chain(prev, new);
\r
79 + bio_get(prev); /* for xfs_destroy_ioend */
\r
85 @@ -614,14 +614,14 @@ xfs_add_to_ioend(
\r
87 list_add(&wpc->ioend->io_list, iolist);
\r
88 wpc->ioend = xfs_alloc_ioend(inode, wpc->io_type, offset,
\r
90 + bdev, sector, wbc);
\r
93 if (!__bio_try_merge_page(wpc->ioend->io_bio, page, len, poff)) {
\r
95 atomic_inc(&iop->write_count);
\r
96 if (bio_full(wpc->ioend->io_bio))
\r
97 - xfs_chain_bio(wpc->ioend, wbc, bdev, sector);
\r
98 + wpc->ioend->io_bio = xfs_chain_bio(wpc->ioend->io_bio);
\r
99 __bio_add_page(wpc->ioend->io_bio, page, len, poff);
\r
106 Link every newly allocated writeback bio to cgroup pointed to by the
\r
107 writeback control structure, and charge every byte written back to it.
\r
109 Tested-by: Stefan Priebe - Profihost AG <s.priebe@profihost.ag>
\r
110 Signed-off-by: Christoph Hellwig <hch@lst.de>
\r
112 fs/xfs/xfs_aops.c | 4 +++-
\r
113 fs/xfs/xfs_super.c | 2 ++
\r
114 2 files changed, 5 insertions(+), 1 deletion(-)
\r
116 diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
\r
117 index 9cceb90e77c5..73c291aeae17 100644
\r
118 --- a/fs/xfs/xfs_aops.c
\r
119 +++ b/fs/xfs/xfs_aops.c
\r
120 @@ -700,6 +700,7 @@ xfs_alloc_ioend(
\r
121 bio->bi_iter.bi_sector = sector;
\r
122 bio->bi_opf = REQ_OP_WRITE | wbc_to_write_flags(wbc);
\r
123 bio->bi_write_hint = inode->i_write_hint;
\r
124 + wbc_init_bio(wbc, bio);
\r
126 ioend = container_of(bio, struct xfs_ioend, io_inline_bio);
\r
127 INIT_LIST_HEAD(&ioend->io_list);
\r
128 @@ -727,7 +728,7 @@ xfs_chain_bio(
\r
131 new = bio_alloc(GFP_NOFS, BIO_MAX_PAGES);
\r
132 - bio_copy_dev(new, prev);
\r
133 + bio_copy_dev(new, prev);/* also copies over blkcg information */
\r
134 new->bi_iter.bi_sector = bio_end_sector(prev);
\r
135 new->bi_opf = prev->bi_opf;
\r
136 new->bi_write_hint = prev->bi_write_hint;
\r
137 @@ -782,6 +783,7 @@ xfs_add_to_ioend(
\r
140 wpc->ioend->io_size += len;
\r
141 + wbc_account_io(wbc, page, len);
\r
145 diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
\r
146 index 594c119824cc..ee0df8f611ff 100644
\r
147 --- a/fs/xfs/xfs_super.c
\r
148 +++ b/fs/xfs/xfs_super.c
\r
149 @@ -1685,6 +1685,8 @@ xfs_fs_fill_super(
\r
150 sb->s_maxbytes = xfs_max_file_offset(sb->s_blocksize_bits);
\r
151 sb->s_max_links = XFS_MAXLINK;
\r
152 sb->s_time_gran = 1;
\r
153 + sb->s_iflags |= SB_I_CGROUPWB;
\r
155 set_posix_acl_flag(sb);
\r
157 /* version 5 superblocks support inode version counters. */
\r