writeback: implement [locked_]inode_to_wb_and_lock_list()
authorTejun Heo <tj@kernel.org>
Thu, 28 May 2015 18:50:52 +0000 (14:50 -0400)
committerJens Axboe <axboe@fb.com>
Tue, 2 Jun 2015 14:40:20 +0000 (08:40 -0600)
commit87e1d789bf55b12fa7c1cdce024499aee3bc0af0
tree39c8f22f5066b8fd0a9326719d6ca4597905a34f
parent2a81490811d0296d390c571bb64eaa93e5ed7def
writeback: implement [locked_]inode_to_wb_and_lock_list()

cgroup writeback currently assumes that inode to wb association
doesn't change; however, with the planned foreign inode wb switching
mechanism, the association will change dynamically.

When an inode needs to be put on one of the IO lists of its wb, the
current code simply calls inode_to_wb() and locks the returned wb;
however, with the planned wb switching, the association may change
before locking the wb and may even get released.

This patch implements [locked_]inode_to_wb_and_lock_list() which pins
the associated wb while holding i_lock, releases it, acquires
wb->list_lock and verifies that the association hasn't changed
inbetween.  As the association will be protected by both locks among
other things, this guarantees that the wb is the inode's associated wb
until the list_lock is released.

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>
fs/fs-writeback.c
This page took 0.02493 seconds and 5 git commands to generate.