Commit aa1df6ca authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] sync_inodes_sb() stack reduction

Reduce stack consumption in sync_inodes_sb() via read_page_state().
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 973a4850
...@@ -433,18 +433,15 @@ writeback_inodes(struct writeback_control *wbc) ...@@ -433,18 +433,15 @@ writeback_inodes(struct writeback_control *wbc)
*/ */
void sync_inodes_sb(struct super_block *sb, int wait) void sync_inodes_sb(struct super_block *sb, int wait)
{ {
struct page_state ps;
struct writeback_control wbc = { struct writeback_control wbc = {
.bdi = NULL,
.sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_HOLD, .sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_HOLD,
.older_than_this = NULL,
.nr_to_write = 0,
}; };
unsigned long nr_dirty = read_page_state(nr_dirty);
unsigned long nr_unstable = read_page_state(nr_unstable);
get_page_state(&ps); wbc.nr_to_write = nr_dirty + nr_unstable +
wbc.nr_to_write = ps.nr_dirty + ps.nr_unstable +
(inodes_stat.nr_inodes - inodes_stat.nr_unused) + (inodes_stat.nr_inodes - inodes_stat.nr_unused) +
ps.nr_dirty + ps.nr_unstable; nr_dirty + nr_unstable;
wbc.nr_to_write += wbc.nr_to_write / 2; /* Bit more for luck */ wbc.nr_to_write += wbc.nr_to_write / 2; /* Bit more for luck */
spin_lock(&inode_lock); spin_lock(&inode_lock);
sync_sb_inodes(sb, &wbc); sync_sb_inodes(sb, &wbc);
......
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