[PATCH] mpage_readpage unable to handle bigger requests

From: Badari Pulavarty
Date: Fri Aug 06 2004 - 16:48:12 EST


Hi Andrew,

I remember fixing this long time ago when we are playing we large
readhead testing. But I don't see the fix making into the tree.

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

Fix is to, ask for the maxium driver can handle.

Please include this patch.


Thanks,
Badari


--- linux.org/fs/mpage.c 2004-08-07 02:15:12.962350304 -0700
+++ linux/fs/mpage.c 2004-08-07 02:17:55.765600448 -0700
@@ -290,7 +290,7 @@ do_mpage_readpage(struct bio *bio, struc
alloc_new:
if (bio == NULL) {
bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9),
- nr_pages, GFP_KERNEL);
+ min(nr_pages, bio_get_nr_vecs(bdev)), GFP_KERNEL);
if (bio == NULL)
goto confused;
}