* [PATCH] fs-writeback : check sync bit earlier in inode_wait_for_writeback
@ 2010-04-16 15:33 Richard Kennedy
0 siblings, 0 replies; only message in thread
From: Richard Kennedy @ 2010-04-16 15:33 UTC (permalink / raw)
To: Alexander Viro, Jens Axboe; +Cc: lkml, linux-fsdevel, Wu Fengguang
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>
----
patch against 2.6.34-rc4
compiled & tested on 86_64
regards
Richard
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 4b37f7c..b1e398e 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -398,11 +398,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);
+ }
}
/*
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-04-16 15:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-16 15:33 [PATCH] fs-writeback : check sync bit earlier in inode_wait_for_writeback Richard Kennedy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).