ext4: stop looping in ext4_num_dirty_pages when max_pages reached

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>
This commit is contained in:
Eric Sandeen 2010-10-27 21:30:03 -04:00 committed by Theodore Ts'o
parent fb1813f4a8
commit 659c6009ca

View file

@ -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);
}