diff options
author | Richard Kennedy <richard@rsk.demon.co.uk> | 2010-05-24 17:32:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-25 11:07:00 -0400 |
commit | 58a9d3d8db06ca2ec31f64ec49ab0aeb89971b85 (patch) | |
tree | 70c695b6473d4d25b32a2946e053742f6c49755e /fs/fs-writeback.c | |
parent | ec95f53aa6ed62ba68660cb19c8474ebe9025cce (diff) |
fs-writeback: check sync bit earlier in inode_wait_for_writeback
When wb_writeback() hasn't written anything it will re-acquire the inode
lock before calling inode_wait_for_writeback.
This change tests the sync bit first so that is doesn't need to drop &
re-acquire the lock if the inode became available while wb_writeback() was
waiting to get the lock.
Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/fs-writeback.c')
-rw-r--r-- | fs/fs-writeback.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 5c4161f1fd9a..ea8592b90696 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -409,11 +409,11 @@ static void inode_wait_for_writeback(struct inode *inode) | |||
409 | wait_queue_head_t *wqh; | 409 | wait_queue_head_t *wqh; |
410 | 410 | ||
411 | wqh = bit_waitqueue(&inode->i_state, __I_SYNC); | 411 | wqh = bit_waitqueue(&inode->i_state, __I_SYNC); |
412 | do { | 412 | while (inode->i_state & I_SYNC) { |
413 | spin_unlock(&inode_lock); | 413 | spin_unlock(&inode_lock); |
414 | __wait_on_bit(wqh, &wq, inode_wait, TASK_UNINTERRUPTIBLE); | 414 | __wait_on_bit(wqh, &wq, inode_wait, TASK_UNINTERRUPTIBLE); |
415 | spin_lock(&inode_lock); | 415 | spin_lock(&inode_lock); |
416 | } while (inode->i_state & I_SYNC); | 416 | } |
417 | } | 417 | } |
418 | 418 | ||
419 | /* | 419 | /* |