[PATCH] fs-writeback : check sync bit earlier in inode_wait_for_writeback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>

----
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);
+	}
 }
 
 /*


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux