aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorSuparna Bhattacharya <suparna@in.ibm.com>2004-08-22 22:59:38 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-08-22 22:59:38 -0700
commit013a35405e7eb81824e19041d82e12f09948e647 (patch)
treeabe446289700fc7d1163fb7b788c9cf54225c89c /mm
parentf07812ca2925f6dc6027883ab15891781dba4827 (diff)
downloadhistory-013a35405e7eb81824e19041d82e12f09948e647.tar.gz
[PATCH] Fix writeback page range to use exact limits
wait_on_page_writeback_range shouldn't wait for pages beyond the specified range. Ideally, the radix-tree-lookup could accept an end_index parameter so that it doesn't return the extra pages in the first place, but for now we just add a few extra checks to skip such pages. Signed-off-by: Suparna Bhattacharya <suparna@in.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/filemap.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index a29efae1832c8c..912afa1bdc1536 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -198,7 +198,8 @@ static int wait_on_page_writeback_range(struct address_space *mapping,
pagevec_init(&pvec, 0);
index = start;
- while ((nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
+ while ((index <= end) &&
+ (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
PAGECACHE_TAG_WRITEBACK,
min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1)) != 0) {
unsigned i;
@@ -206,6 +207,10 @@ static int wait_on_page_writeback_range(struct address_space *mapping,
for (i = 0; i < nr_pages; i++) {
struct page *page = pvec.pages[i];
+ /* until radix tree lookup accepts end_index */
+ if (page->index > end)
+ continue;
+
wait_on_page_writeback(page);
if (PageError(page))
ret = -EIO;