Commit 365b94ae authored by Jan Kara's avatar Jan Kara Committed by Fengguang Wu

writeback: Move clearing of I_SYNC into inode_sync_complete()

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: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
parent 68809c71
...@@ -231,11 +231,8 @@ static void requeue_io(struct inode *inode, struct bdi_writeback *wb) ...@@ -231,11 +231,8 @@ static void requeue_io(struct inode *inode, struct bdi_writeback *wb)
static void inode_sync_complete(struct inode *inode) static void inode_sync_complete(struct inode *inode)
{ {
/* inode->i_state &= ~I_SYNC;
* Prevent speculative execution through /* Waiters must see I_SYNC cleared before being woken up */
* spin_unlock(&wb->list_lock);
*/
smp_mb(); smp_mb();
wake_up_bit(&inode->i_state, __I_SYNC); wake_up_bit(&inode->i_state, __I_SYNC);
} }
...@@ -436,7 +433,6 @@ writeback_single_inode(struct inode *inode, struct bdi_writeback *wb, ...@@ -436,7 +433,6 @@ writeback_single_inode(struct inode *inode, struct bdi_writeback *wb,
spin_lock(&wb->list_lock); spin_lock(&wb->list_lock);
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
inode->i_state &= ~I_SYNC;
if (!(inode->i_state & I_FREEING)) { if (!(inode->i_state & I_FREEING)) {
/* /*
* Sync livelock prevention. Each inode is tagged and synced in * Sync livelock prevention. Each inode is tagged and synced in
......
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