Skip to content

Commit

Permalink
ext4: stop looping in ext4_num_dirty_pages when max_pages reached
Browse files Browse the repository at this point in the history
Today we simply break out of the inner loop when we have accumulated
max_pages; this keeps scanning forwad and doing pagevec_lookup_tag()
in the while (!done) loop, this does potentially a lot of work
with no net effect.

When we have accumulated max_pages, just clean up and return.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
  • Loading branch information
Eric Sandeen authored and Theodore Ts'o committed Oct 28, 2010
1 parent fb1813f commit 659c600
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1207,8 +1207,10 @@ static pgoff_t ext4_num_dirty_pages(struct inode *inode, pgoff_t idx,
break;
idx++;
num++;
if (num >= max_pages)
if (num >= max_pages) {
done = 1;
break;
}
}
pagevec_release(&pvec);
}
Expand Down

0 comments on commit 659c600

Please sign in to comment.