1 Adds a module parameter to control raid5's internal cache size.
3 Index: linux-2.6.9/drivers/md/raid5.c
4 ===================================================================
5 --- linux-2.6.9.orig/drivers/md/raid5.c 2006-05-21 17:57:25.000000000 +0400
6 +++ linux-2.6.9/drivers/md/raid5.c 2006-05-22 00:01:30.000000000 +0400
11 -#define NR_STRIPES 256
12 +static int raid5_nr_stripes = 256 * 8;
14 #define STRIPE_SIZE PAGE_SIZE
15 #define STRIPE_SHIFT (PAGE_SHIFT - 9)
16 #define STRIPE_SECTORS (STRIPE_SIZE>>9)
17 @@ -92,7 +93,7 @@ static inline void __release_stripe(raid
18 list_add_tail(&sh->lru, &conf->inactive_list);
19 atomic_dec(&conf->active_stripes);
20 if (!conf->inactive_blocked ||
21 - atomic_read(&conf->active_stripes) < (NR_STRIPES*3/4))
22 + atomic_read(&conf->active_stripes) < (conf->max_nr_stripes*3/4))
23 wake_up(&conf->wait_for_stripe);
26 @@ -255,7 +256,7 @@ static struct stripe_head *get_active_st
27 conf->inactive_blocked = 1;
28 wait_event_lock_irq(conf->wait_for_stripe,
29 !list_empty(&conf->inactive_list) &&
30 - (atomic_read(&conf->active_stripes) < (NR_STRIPES *3/4)
31 + (atomic_read(&conf->active_stripes) < (conf->max_nr_stripes *3/4)
32 || !conf->inactive_blocked),
34 unplug_slaves(conf->mddev);
35 @@ -1637,7 +1638,7 @@ static int run (mddev_t *mddev)
36 conf->chunk_size = mddev->chunk_size;
37 conf->level = mddev->level;
38 conf->algorithm = mddev->layout;
39 - conf->max_nr_stripes = NR_STRIPES;
40 + conf->max_nr_stripes = raid5_nr_stripes;
42 /* device size must be a multiple of chunk size */
43 mddev->size &= ~(mddev->chunk_size/1024 -1);
44 @@ -1957,5 +1958,6 @@ static void raid5_exit (void)
46 module_init(raid5_init);
47 module_exit(raid5_exit);
48 +module_param(raid5_nr_stripes, int, 0644);
49 MODULE_LICENSE("GPL");
50 MODULE_ALIAS("md-personality-4"); /* RAID5 */