diff options
author | Tao Ma <boyu.mt@taobao.com> | 2011-10-31 17:30:44 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-10-31 17:30:44 -0400 |
commit | 0edeb71dc9133bfb505d3bf59642e07cd936613e (patch) | |
tree | bcb68e2676d9bba1e4e4e28fb1ba8d382caf26eb /fs/ext4/inode.c | |
parent | b82e384c7bb9a19036b4daf58fa216df7cd48aa0 (diff) |
ext4: Create helper function for EXT4_IO_END_UNWRITTEN and i_aiodio_unwritten
EXT4_IO_END_UNWRITTEN flag set and the increase of i_aiodio_unwritten
should be done simultaneously since ext4_end_io_nolock always clear
the flag and decrease the counter in the same time.
We have found some bugs that the flag is set while leaving
i_aiodio_unwritten unchanged(commit 32c80b32c053d). So this patch just tries
to create a helper function to wrap them to avoid any future bug.
The idea is inspired by Eric.
Cc: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index e4b26faac5ff..60af5126eb05 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -2831,10 +2831,7 @@ static void ext4_end_io_buffer_write(struct buffer_head *bh, int uptodate) | |||
2831 | * but being more careful is always safe for the future change. | 2831 | * but being more careful is always safe for the future change. |
2832 | */ | 2832 | */ |
2833 | inode = io_end->inode; | 2833 | inode = io_end->inode; |
2834 | if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) { | 2834 | ext4_set_io_unwritten_flag(inode, io_end); |
2835 | io_end->flag |= EXT4_IO_END_UNWRITTEN; | ||
2836 | atomic_inc(&EXT4_I(inode)->i_aiodio_unwritten); | ||
2837 | } | ||
2838 | 2835 | ||
2839 | /* Add the io_end to per-inode completed io list*/ | 2836 | /* Add the io_end to per-inode completed io list*/ |
2840 | spin_lock_irqsave(&EXT4_I(inode)->i_completed_io_lock, flags); | 2837 | spin_lock_irqsave(&EXT4_I(inode)->i_completed_io_lock, flags); |