Commit 34e51a5e authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe

blkcg, writeback: Rename wbc_account_io() to wbc_account_cgroup_owner()

wbc_account_io() does a very specific job - try to see which cgroup is
actually dirtying an inode and transfer its ownership to the majority
dirtier if needed.  The name is too generic and confusing.  Let's
rename it to something more specific.
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 9b0eb69b
...@@ -2114,7 +2114,7 @@ following two functions. ...@@ -2114,7 +2114,7 @@ following two functions.
a queue (device) has been associated with the bio and a queue (device) has been associated with the bio and
before submission. before submission.
wbc_account_io(@wbc, @page, @bytes) wbc_account_cgroup_owner(@wbc, @page, @bytes)
Should be called for each data segment being written out. Should be called for each data segment being written out.
While this function doesn't care exactly when it's called While this function doesn't care exactly when it's called
during the writeback session, it's the easiest and most during the writeback session, it's the easiest and most
......
...@@ -2911,7 +2911,7 @@ static int submit_extent_page(unsigned int opf, struct extent_io_tree *tree, ...@@ -2911,7 +2911,7 @@ static int submit_extent_page(unsigned int opf, struct extent_io_tree *tree,
bio = NULL; bio = NULL;
} else { } else {
if (wbc) if (wbc)
wbc_account_io(wbc, page, page_size); wbc_account_cgroup_owner(wbc, page, page_size);
return 0; return 0;
} }
} }
...@@ -2924,7 +2924,7 @@ static int submit_extent_page(unsigned int opf, struct extent_io_tree *tree, ...@@ -2924,7 +2924,7 @@ static int submit_extent_page(unsigned int opf, struct extent_io_tree *tree,
bio->bi_opf = opf; bio->bi_opf = opf;
if (wbc) { if (wbc) {
wbc_init_bio(wbc, bio); wbc_init_bio(wbc, bio);
wbc_account_io(wbc, page, page_size); wbc_account_cgroup_owner(wbc, page, page_size);
} }
*bio_ret = bio; *bio_ret = bio;
......
...@@ -3093,7 +3093,7 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, ...@@ -3093,7 +3093,7 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
if (wbc) { if (wbc) {
wbc_init_bio(wbc, bio); wbc_init_bio(wbc, bio);
wbc_account_io(wbc, bh->b_page, bh->b_size); wbc_account_cgroup_owner(wbc, bh->b_page, bh->b_size);
} }
submit_bio(bio); submit_bio(bio);
......
...@@ -404,7 +404,7 @@ static int io_submit_add_bh(struct ext4_io_submit *io, ...@@ -404,7 +404,7 @@ static int io_submit_add_bh(struct ext4_io_submit *io,
ret = bio_add_page(io->io_bio, page, bh->b_size, bh_offset(bh)); ret = bio_add_page(io->io_bio, page, bh->b_size, bh_offset(bh));
if (ret != bh->b_size) if (ret != bh->b_size)
goto submit_and_retry; goto submit_and_retry;
wbc_account_io(io->io_wbc, page, bh->b_size); wbc_account_cgroup_owner(io->io_wbc, page, bh->b_size);
io->io_next_block++; io->io_next_block++;
return 0; return 0;
} }
......
...@@ -470,7 +470,7 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio) ...@@ -470,7 +470,7 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio)
} }
if (fio->io_wbc && !is_read_io(fio->op)) if (fio->io_wbc && !is_read_io(fio->op))
wbc_account_io(fio->io_wbc, page, PAGE_SIZE); wbc_account_cgroup_owner(fio->io_wbc, page, PAGE_SIZE);
bio_set_op_attrs(bio, fio->op, fio->op_flags); bio_set_op_attrs(bio, fio->op, fio->op_flags);
...@@ -537,7 +537,7 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio) ...@@ -537,7 +537,7 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)
} }
if (fio->io_wbc) if (fio->io_wbc)
wbc_account_io(fio->io_wbc, bio_page, PAGE_SIZE); wbc_account_cgroup_owner(fio->io_wbc, bio_page, PAGE_SIZE);
io->last_block_in_bio = fio->new_blkaddr; io->last_block_in_bio = fio->new_blkaddr;
f2fs_trace_ios(fio, 0); f2fs_trace_ios(fio, 0);
......
...@@ -706,7 +706,7 @@ void wbc_detach_inode(struct writeback_control *wbc) ...@@ -706,7 +706,7 @@ void wbc_detach_inode(struct writeback_control *wbc)
EXPORT_SYMBOL_GPL(wbc_detach_inode); EXPORT_SYMBOL_GPL(wbc_detach_inode);
/** /**
* wbc_account_io - account IO issued during writeback * wbc_account_cgroup_owner - account writeback to update inode cgroup ownership
* @wbc: writeback_control of the writeback in progress * @wbc: writeback_control of the writeback in progress
* @page: page being written out * @page: page being written out
* @bytes: number of bytes being written out * @bytes: number of bytes being written out
...@@ -715,8 +715,8 @@ EXPORT_SYMBOL_GPL(wbc_detach_inode); ...@@ -715,8 +715,8 @@ EXPORT_SYMBOL_GPL(wbc_detach_inode);
* controlled by @wbc. Keep the book for foreign inode detection. See * controlled by @wbc. Keep the book for foreign inode detection. See
* wbc_detach_inode(). * wbc_detach_inode().
*/ */
void wbc_account_io(struct writeback_control *wbc, struct page *page, void wbc_account_cgroup_owner(struct writeback_control *wbc, struct page *page,
size_t bytes) size_t bytes)
{ {
struct cgroup_subsys_state *css; struct cgroup_subsys_state *css;
int id; int id;
...@@ -753,7 +753,7 @@ void wbc_account_io(struct writeback_control *wbc, struct page *page, ...@@ -753,7 +753,7 @@ void wbc_account_io(struct writeback_control *wbc, struct page *page,
else else
wbc->wb_tcand_bytes -= min(bytes, wbc->wb_tcand_bytes); wbc->wb_tcand_bytes -= min(bytes, wbc->wb_tcand_bytes);
} }
EXPORT_SYMBOL_GPL(wbc_account_io); EXPORT_SYMBOL_GPL(wbc_account_cgroup_owner);
/** /**
* inode_congested - test whether an inode is congested * inode_congested - test whether an inode is congested
......
...@@ -647,7 +647,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc, ...@@ -647,7 +647,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
* the confused fail path above (OOM) will be very confused when * the confused fail path above (OOM) will be very confused when
* it finds all bh marked clean (i.e. it will not write anything) * it finds all bh marked clean (i.e. it will not write anything)
*/ */
wbc_account_io(wbc, page, PAGE_SIZE); wbc_account_cgroup_owner(wbc, page, PAGE_SIZE);
length = first_unmapped << blkbits; length = first_unmapped << blkbits;
if (bio_add_page(bio, page, length, 0) < length) { if (bio_add_page(bio, page, length, 0) < length) {
bio = mpage_bio_submit(REQ_OP_WRITE, op_flags, bio); bio = mpage_bio_submit(REQ_OP_WRITE, op_flags, bio);
......
...@@ -188,8 +188,8 @@ void wbc_attach_and_unlock_inode(struct writeback_control *wbc, ...@@ -188,8 +188,8 @@ void wbc_attach_and_unlock_inode(struct writeback_control *wbc,
struct inode *inode) struct inode *inode)
__releases(&inode->i_lock); __releases(&inode->i_lock);
void wbc_detach_inode(struct writeback_control *wbc); void wbc_detach_inode(struct writeback_control *wbc);
void wbc_account_io(struct writeback_control *wbc, struct page *page, void wbc_account_cgroup_owner(struct writeback_control *wbc, struct page *page,
size_t bytes); size_t bytes);
void cgroup_writeback_umount(void); void cgroup_writeback_umount(void);
/** /**
...@@ -291,8 +291,8 @@ static inline void wbc_init_bio(struct writeback_control *wbc, struct bio *bio) ...@@ -291,8 +291,8 @@ static inline void wbc_init_bio(struct writeback_control *wbc, struct bio *bio)
{ {
} }
static inline void wbc_account_io(struct writeback_control *wbc, static inline void wbc_account_cgroup_owner(struct writeback_control *wbc,
struct page *page, size_t bytes) struct page *page, size_t bytes)
{ {
} }
......
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