Commit 13c61952 authored by Badari Pulavarty's avatar Badari Pulavarty Committed by Linus Torvalds

[PATCH] Fix mpage_readpage() for big requests

The problem is, if we increase our readhead size arbitrarily (say 2M), we
call mpage_readpages() with 2M and when it tries to allocated a bio enough to
fit 2M it fails, then we kick it back to "confused" code - which does 4K at
a time.

The fix is to ask for the maxium the driver can handle.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7b4731ff
...@@ -290,7 +290,8 @@ do_mpage_readpage(struct bio *bio, struct page *page, unsigned nr_pages, ...@@ -290,7 +290,8 @@ do_mpage_readpage(struct bio *bio, struct page *page, unsigned nr_pages,
alloc_new: alloc_new:
if (bio == NULL) { if (bio == NULL) {
bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9), bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9),
nr_pages, GFP_KERNEL); min_t(int, nr_pages, bio_get_nr_vecs(bdev)),
GFP_KERNEL);
if (bio == NULL) if (bio == NULL)
goto confused; goto confused;
} }
......
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