aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fs-writeback.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2012-05-03 08:47:55 -0400
committerFengguang Wu <fengguang.wu@intel.com>2012-05-06 01:43:38 -0400
commit365b94ae67d2915d412b593d47449a6bffed9d37 (patch)
treeed5d92a05a7c4670439632a20895f523a6553720 /fs/fs-writeback.c
parent68809c7108b9a75baf2a888b1c19ce1a4680f600 (diff)
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: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Diffstat (limited to 'fs/fs-writeback.c')
-rw-r--r--fs/fs-writeback.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 539f36cf3e4a..dd41437b7a1f 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -231,11 +231,8 @@ static void requeue_io(struct inode *inode, struct bdi_writeback *wb)
231 231
232static void inode_sync_complete(struct inode *inode) 232static void inode_sync_complete(struct inode *inode)
233{ 233{
234 /* 234 inode->i_state &= ~I_SYNC;
235 * Prevent speculative execution through 235 /* Waiters must see I_SYNC cleared before being woken up */
236 * spin_unlock(&wb->list_lock);
237 */
238
239 smp_mb(); 236 smp_mb();
240 wake_up_bit(&inode->i_state, __I_SYNC); 237 wake_up_bit(&inode->i_state, __I_SYNC);
241} 238}
@@ -436,7 +433,6 @@ writeback_single_inode(struct inode *inode, struct bdi_writeback *wb,
436 433
437 spin_lock(&wb->list_lock); 434 spin_lock(&wb->list_lock);
438 spin_lock(&inode->i_lock); 435 spin_lock(&inode->i_lock);
439 inode->i_state &= ~I_SYNC;
440 if (!(inode->i_state & I_FREEING)) { 436 if (!(inode->i_state & I_FREEING)) {
441 /* 437 /*
442 * Sync livelock prevention. Each inode is tagged and synced in 438 * Sync livelock prevention. Each inode is tagged and synced in