diff options
author | Tejun Heo <tj@kernel.org> | 2015-06-02 08:39:48 -0600 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-06-02 08:39:48 -0600 |
commit | b16b1deb553adcd7b3b7ce3e6d6fd1b923f314da (patch) | |
tree | 90818c22fd780699cdcb7c35b12f47b860de682a /fs/mpage.c | |
parent | 21c6321fbb3a3787af07f1bc031d713a707fb69c (diff) | |
download | op-kernel-dev-b16b1deb553adcd7b3b7ce3e6d6fd1b923f314da.zip op-kernel-dev-b16b1deb553adcd7b3b7ce3e6d6fd1b923f314da.tar.gz |
writeback: make writeback_control track the inode being written back
Currently, for cgroup writeback, the IO submission paths directly
associate the bio's with the blkcg from inode_to_wb_blkcg_css();
however, it'd be necessary to keep more writeback context to implement
foreign inode writeback detection. wbc (writeback_control) is the
natural fit for the extra context - it persists throughout the
writeback of each inode and is passed all the way down to IO
submission paths.
This patch adds wbc_attach_and_unlock_inode(), wbc_detach_inode(), and
wbc_attach_fdatawrite_inode() which are used to associate wbc with the
inode being written back. IO submission paths now use wbc_init_bio()
instead of directly associating bio's with blkcg themselves. This
leaves inode_to_wb_blkcg_css() w/o any user. The function is removed.
wbc currently only tracks the associated wb (bdi_writeback). Future
patches will add more for foreign inode detection. The association is
established under i_lock which will be depended upon when migrating
foreign inodes to other wb's.
As currently, once established, inode to wb association never changes,
going through wbc when initializing bio's doesn't cause any behavior
changes.
v2: submit_blk_blkcg() now checks whether the wbc is associated with a
wb before dereferencing it. This can happen when pageout() is
writing pages directly without going through the usual writeback
path. As pageout() path is single-threaded, we don't want it to
be blocked behind a slow cgroup and ultimately want it to delegate
actual writing to the usual writeback path.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Jan Kara <jack@suse.cz>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Greg Thelen <gthelen@google.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'fs/mpage.c')
-rw-r--r-- | fs/mpage.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -606,7 +606,7 @@ alloc_new: if (bio == NULL) goto confused; - bio_associate_blkcg(bio, inode_to_wb_blkcg_css(inode)); + wbc_init_bio(wbc, bio); } /* |