Commit 58a9d3d8 authored by Richard Kennedy's avatar Richard Kennedy Committed by Linus Torvalds

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: default avatarRichard Kennedy <>
Cc: Alexander Viro <>
Cc: Jens Axboe <>
Cc: Wu Fengguang <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent ec95f53a
......@@ -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) {
__wait_on_bit(wqh, &wq, inode_wait, TASK_UNINTERRUPTIBLE);
} while (inode->i_state & I_SYNC);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment