[PATCH] Cleanup read_pages()
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Fri, 3 Nov 2006 06:07:06 +0000 (22:07 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 3 Nov 2006 20:27:56 +0000 (12:27 -0800)
Current read_pages() assume ->readpages() frees the passed pages.

This patch free the pages in ->read_pages(), if those were remaining in the
pages_list.  So, readpages() just can ignore the remaining pages in
pages_list.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Steven French <sfrench@us.ibm.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Steven Whitehouse <swhiteho@redhat.com>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
mm/readahead.c

index 1ba736ac03672bc2863662f32ccf972d3189673b..23cb61a01c6e4123f313f5487a5942e7ee4c5fe4 100644 (file)
@@ -173,6 +173,8 @@ static int read_pages(struct address_space *mapping, struct file *filp,
 
        if (mapping->a_ops->readpages) {
                ret = mapping->a_ops->readpages(filp, mapping, pages, nr_pages);
+               /* Clean up the remaining pages */
+               put_pages_list(pages);
                goto out;
        }