From 58a9d3d8db06ca2ec31f64ec49ab0aeb89971b85 Mon Sep 17 00:00:00 2001 From: Richard Kennedy Date: Mon, 24 May 2010 14:32:38 -0700 Subject: 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 Cc: Alexander Viro Cc: Jens Axboe Cc: Wu Fengguang Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/fs-writeback.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 5c4161f..ea8592b 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -409,11 +409,11 @@ static void inode_wait_for_writeback(struct inode *inode) wait_queue_head_t *wqh; wqh = bit_waitqueue(&inode->i_state, __I_SYNC); - do { + while (inode->i_state & I_SYNC) { spin_unlock(&inode_lock); __wait_on_bit(wqh, &wq, inode_wait, TASK_UNINTERRUPTIBLE); spin_lock(&inode_lock); - } while (inode->i_state & I_SYNC); + } } /* -- cgit v1.1