diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2013-01-10 00:47:57 -0500 |
---|---|---|
committer | Fengguang Wu <fengguang.wu@intel.com> | 2013-01-11 21:47:43 -0500 |
commit | 10ee27a06cc8eb57f83342a8eabcb75deb872d52 (patch) | |
tree | d14f69011b7aa1896f1aef37cb2b64f868bce459 /include/linux | |
parent | 9931faca02c604c22335f5a935a501bb2ace6e20 (diff) |
vfs: re-implement writeback_inodes_sb(_nr)_if_idle() and rename them
writeback_inodes_sb(_nr)_if_idle() is re-implemented by replacing down_read()
with down_read_trylock() because
- If ->s_umount is write locked, then the sb is not idle. That is
writeback_inodes_sb(_nr)_if_idle() needn't wait for the lock.
- writeback_inodes_sb(_nr)_if_idle() grabs s_umount lock when it want to start
writeback, it may bring us deadlock problem when doing umount. In order to
fix the problem, ext4 and btrfs implemented their own writeback functions
instead of writeback_inodes_sb(_nr)_if_idle(), but it introduced the redundant
code, it is better to implement a new writeback_inodes_sb(_nr)_if_idle().
The name of these two functions is cumbersome, so rename them to
try_to_writeback_inodes_sb(_nr).
This idea came from Christoph Hellwig.
Some code is from the patch of Kamal Mostafa.
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/writeback.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index b82a83aba311..9a9367c0c076 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -87,9 +87,9 @@ int inode_wait(void *); | |||
87 | void writeback_inodes_sb(struct super_block *, enum wb_reason reason); | 87 | void writeback_inodes_sb(struct super_block *, enum wb_reason reason); |
88 | void writeback_inodes_sb_nr(struct super_block *, unsigned long nr, | 88 | void writeback_inodes_sb_nr(struct super_block *, unsigned long nr, |
89 | enum wb_reason reason); | 89 | enum wb_reason reason); |
90 | int writeback_inodes_sb_if_idle(struct super_block *, enum wb_reason reason); | 90 | int try_to_writeback_inodes_sb(struct super_block *, enum wb_reason reason); |
91 | int writeback_inodes_sb_nr_if_idle(struct super_block *, unsigned long nr, | 91 | int try_to_writeback_inodes_sb_nr(struct super_block *, unsigned long nr, |
92 | enum wb_reason reason); | 92 | enum wb_reason reason); |
93 | void sync_inodes_sb(struct super_block *); | 93 | void sync_inodes_sb(struct super_block *); |
94 | long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages, | 94 | long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages, |
95 | enum wb_reason reason); | 95 | enum wb_reason reason); |