Skip to content

Commit ae8547b

Browse files
Hans ReiserArtem Bityutskiy
authored andcommitted
VFS: move inode_lock into sync_sb_inodes
This patch makes 'sync_sb_inodes()' lock 'inode_lock', rather than expect that the caller will do this. This change was previously done by Hans Reiser <[email protected]> and sat in the -mm tree. Signed-off-by: Artem Bityutskiy <[email protected]>
1 parent bce7f79 commit ae8547b

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

fs/fs-writeback.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,6 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
424424
* WB_SYNC_HOLD is a hack for sys_sync(): reattach the inode to sb->s_dirty so
425425
* that it can be located for waiting on in __writeback_single_inode().
426426
*
427-
* Called under inode_lock.
428-
*
429427
* If `bdi' is non-zero then we're being asked to writeback a specific queue.
430428
* This function assumes that the blockdev superblock's inodes are backed by
431429
* a variety of queues, so all inodes are searched. For other superblocks,
@@ -446,6 +444,7 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
446444
{
447445
const unsigned long start = jiffies; /* livelock avoidance */
448446

447+
spin_lock(&inode_lock);
449448
if (!wbc->for_kupdate || list_empty(&sb->s_io))
450449
queue_io(sb, wbc->older_than_this);
451450

@@ -524,6 +523,7 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
524523
if (!list_empty(&sb->s_more_io))
525524
wbc->more_io = 1;
526525
}
526+
spin_unlock(&inode_lock);
527527
return; /* Leave any unwritten inodes on s_io */
528528
}
529529

@@ -565,11 +565,8 @@ writeback_inodes(struct writeback_control *wbc)
565565
* be unmounted by the time it is released.
566566
*/
567567
if (down_read_trylock(&sb->s_umount)) {
568-
if (sb->s_root) {
569-
spin_lock(&inode_lock);
568+
if (sb->s_root)
570569
sync_sb_inodes(sb, wbc);
571-
spin_unlock(&inode_lock);
572-
}
573570
up_read(&sb->s_umount);
574571
}
575572
spin_lock(&sb_lock);
@@ -607,9 +604,7 @@ void sync_inodes_sb(struct super_block *sb, int wait)
607604
(inodes_stat.nr_inodes - inodes_stat.nr_unused) +
608605
nr_dirty + nr_unstable;
609606
wbc.nr_to_write += wbc.nr_to_write / 2; /* Bit more for luck */
610-
spin_lock(&inode_lock);
611607
sync_sb_inodes(sb, &wbc);
612-
spin_unlock(&inode_lock);
613608
}
614609

615610
/*

0 commit comments

Comments
 (0)