Commit b68bd84e authored by Kirill Korotaev's avatar Kirill Korotaev Committed by Linus Torvalds

[PATCH] Rearrangement of inode_lock in writeback_inodes()

This patch reaaranges inode_lock taking in writeback_inodes().  It narrows
down use of inode_lock and removes unneccassary nesting of sb_lock and
inode_lock.  Instead of holding inode_lock for all the time I moved it
around sync_sb_inodes() as it is in all other places.
Signed-Off-By: default avatarKirill Korotaev <dev@sw.ru>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4e56755a
...@@ -403,7 +403,6 @@ writeback_inodes(struct writeback_control *wbc) ...@@ -403,7 +403,6 @@ writeback_inodes(struct writeback_control *wbc)
struct super_block *sb; struct super_block *sb;
might_sleep(); might_sleep();
spin_lock(&inode_lock);
spin_lock(&sb_lock); spin_lock(&sb_lock);
restart: restart:
sb = sb_entry(super_blocks.prev); sb = sb_entry(super_blocks.prev);
...@@ -418,8 +417,11 @@ writeback_inodes(struct writeback_control *wbc) ...@@ -418,8 +417,11 @@ writeback_inodes(struct writeback_control *wbc)
* be unmounted by the time it is released. * be unmounted by the time it is released.
*/ */
if (down_read_trylock(&sb->s_umount)) { if (down_read_trylock(&sb->s_umount)) {
if (sb->s_root) if (sb->s_root) {
spin_lock(&inode_lock);
sync_sb_inodes(sb, wbc); sync_sb_inodes(sb, wbc);
spin_unlock(&inode_lock);
}
up_read(&sb->s_umount); up_read(&sb->s_umount);
} }
spin_lock(&sb_lock); spin_lock(&sb_lock);
...@@ -430,7 +432,6 @@ writeback_inodes(struct writeback_control *wbc) ...@@ -430,7 +432,6 @@ writeback_inodes(struct writeback_control *wbc)
break; break;
} }
spin_unlock(&sb_lock); spin_unlock(&sb_lock);
spin_unlock(&inode_lock);
} }
/* /*
......
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