From: "H. Peter Anvin" <hpa@zytor.com>

This patch merges the latest change (make sure the readahead size is
always a multiple of the stripe size) from raid5.c into raid6main.c.



---

 drivers/md/raid6main.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletion(-)

diff -puN drivers/md/raid6main.c~raid6-readahead-fix drivers/md/raid6main.c
--- 25/drivers/md/raid6main.c~raid6-readahead-fix	2004-01-09 18:31:39.000000000 -0800
+++ 25-akpm/drivers/md/raid6main.c	2004-01-09 18:31:39.000000000 -0800
@@ -5,7 +5,7 @@
  *	   Copyright (C) 2002, 2003 H. Peter Anvin
  *
  * RAID-6 management functions.  This code is derived from raid5.c.
- * Last merge from raid5.c bkcvs version 1.78.
+ * Last merge from raid5.c bkcvs version 1.79 (kernel 2.6.1).
  *
  * Thanks to Penguin Computing for making the RAID-6 development possible
  * by donating a test server!
@@ -1756,6 +1756,16 @@ static int run (mddev_t *mddev)
 
 	print_raid6_conf(conf);
 
+	/* read-ahead size must cover a whole stripe, which is
+	 * (n-2) * chunksize where 'n' is the number of raid devices
+	 */
+	{
+		int stripe = (mddev->raid_disks-2) * mddev->chunk_size
+			/ PAGE_CACHE_SIZE;
+		if (mddev->queue->backing_dev_info.ra_pages < stripe)
+			mddev->queue->backing_dev_info.ra_pages = stripe;
+	}
+
 	/* Ok, everything is just fine now */
 	mddev->array_size =  mddev->size * (mddev->raid_disks - 2);
 	return 0;

_