Skip to content

Commit

Permalink
writeback: Move clearing of I_SYNC into inode_sync_complete()
Browse files Browse the repository at this point in the history
Move clearing of I_SYNC into inode_sync_complete().  It is more logical to have
clearing of I_SYNC bit and waking of waiters in one place. Also later we will
have two places needing to clear I_SYNC and wake up waiters so this allows them
to use the common helper. Moving of I_SYNC clearing to a later stage of
writeback_single_inode() is safe since we hold i_lock all the time.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
  • Loading branch information
Jan Kara authored and Fengguang Wu committed May 6, 2012
1 parent 68809c7 commit 365b94a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions fs/fs-writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,8 @@ static void requeue_io(struct inode *inode, struct bdi_writeback *wb)

static void inode_sync_complete(struct inode *inode)
{
/*
* Prevent speculative execution through
* spin_unlock(&wb->list_lock);
*/

inode->i_state &= ~I_SYNC;
/* Waiters must see I_SYNC cleared before being woken up */
smp_mb();
wake_up_bit(&inode->i_state, __I_SYNC);
}
Expand Down Expand Up @@ -436,7 +433,6 @@ writeback_single_inode(struct inode *inode, struct bdi_writeback *wb,

spin_lock(&wb->list_lock);
spin_lock(&inode->i_lock);
inode->i_state &= ~I_SYNC;
if (!(inode->i_state & I_FREEING)) {
/*
* Sync livelock prevention. Each inode is tagged and synced in
Expand Down

0 comments on commit 365b94a

Please sign in to comment.