--- /dev/null
+Adds a module parameter to control raid5's internal cache size.
+
+Index: linux-2.6.9/drivers/md/raid5.c
+===================================================================
+--- linux-2.6.9.orig/drivers/md/raid5.c 2006-05-21 17:57:25.000000000 +0400
++++ linux-2.6.9/drivers/md/raid5.c 2006-05-22 00:01:30.000000000 +0400
+@@ -28,7 +28,8 @@
+ * Stripe cache
+ */
+
+-#define NR_STRIPES 256
++static int raid5_nr_stripes = 256 * 8;
++
+ #define STRIPE_SIZE PAGE_SIZE
+ #define STRIPE_SHIFT (PAGE_SHIFT - 9)
+ #define STRIPE_SECTORS (STRIPE_SIZE>>9)
+@@ -92,7 +93,7 @@ static inline void __release_stripe(raid
+ list_add_tail(&sh->lru, &conf->inactive_list);
+ atomic_dec(&conf->active_stripes);
+ if (!conf->inactive_blocked ||
+- atomic_read(&conf->active_stripes) < (NR_STRIPES*3/4))
++ atomic_read(&conf->active_stripes) < (conf->max_nr_stripes*3/4))
+ wake_up(&conf->wait_for_stripe);
+ }
+ }
+@@ -255,7 +256,7 @@ static struct stripe_head *get_active_st
+ conf->inactive_blocked = 1;
+ wait_event_lock_irq(conf->wait_for_stripe,
+ !list_empty(&conf->inactive_list) &&
+- (atomic_read(&conf->active_stripes) < (NR_STRIPES *3/4)
++ (atomic_read(&conf->active_stripes) < (conf->max_nr_stripes *3/4)
+ || !conf->inactive_blocked),
+ conf->device_lock,
+ unplug_slaves(conf->mddev);
+@@ -1637,7 +1638,7 @@ static int run (mddev_t *mddev)
+ conf->chunk_size = mddev->chunk_size;
+ conf->level = mddev->level;
+ conf->algorithm = mddev->layout;
+- conf->max_nr_stripes = NR_STRIPES;
++ conf->max_nr_stripes = raid5_nr_stripes;
+
+ /* device size must be a multiple of chunk size */
+ mddev->size &= ~(mddev->chunk_size/1024 -1);
+@@ -1957,5 +1958,6 @@ static void raid5_exit (void)
+
+ module_init(raid5_init);
+ module_exit(raid5_exit);
++module_param(raid5_nr_stripes, int, 0644);
+ MODULE_LICENSE("GPL");
+ MODULE_ALIAS("md-personality-4"); /* RAID5 */