diff options
author | NeilBrown <neilb@suse.de> | 2005-12-12 05:39:17 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-12-12 12:06:04 -0500 |
commit | 5036805be7b815eb18dcce489d974f3aee4f3841 (patch) | |
tree | 3d112acbe459fafee17f41cb634e483080b48607 /drivers/md/raid5.c | |
parent | 3795bb0fc52fe2af2749f3ad2185cb9c90871ef8 (diff) |
[PATCH] md: use correct size of raid5 stripe cache when measuring how full it is
The raid5 stripe cache was recently changed from fixed size (NR_STRIPES) to
variable size (conf->max_nr_stripes). However there are two places that still
use the constant and as a result, reducing the size of the stripe cache can
result in a deadlock.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 36d5f8ac8265..fafc4bc045f7 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -98,7 +98,7 @@ static inline void __release_stripe(raid5_conf_t *conf, struct stripe_head *sh) | |||
98 | list_add_tail(&sh->lru, &conf->inactive_list); | 98 | list_add_tail(&sh->lru, &conf->inactive_list); |
99 | atomic_dec(&conf->active_stripes); | 99 | atomic_dec(&conf->active_stripes); |
100 | if (!conf->inactive_blocked || | 100 | if (!conf->inactive_blocked || |
101 | atomic_read(&conf->active_stripes) < (NR_STRIPES*3/4)) | 101 | atomic_read(&conf->active_stripes) < (conf->max_nr_stripes*3/4)) |
102 | wake_up(&conf->wait_for_stripe); | 102 | wake_up(&conf->wait_for_stripe); |
103 | } | 103 | } |
104 | } | 104 | } |
@@ -264,7 +264,8 @@ static struct stripe_head *get_active_stripe(raid5_conf_t *conf, sector_t sector | |||
264 | conf->inactive_blocked = 1; | 264 | conf->inactive_blocked = 1; |
265 | wait_event_lock_irq(conf->wait_for_stripe, | 265 | wait_event_lock_irq(conf->wait_for_stripe, |
266 | !list_empty(&conf->inactive_list) && | 266 | !list_empty(&conf->inactive_list) && |
267 | (atomic_read(&conf->active_stripes) < (NR_STRIPES *3/4) | 267 | (atomic_read(&conf->active_stripes) |
268 | < (conf->max_nr_stripes *3/4) | ||
268 | || !conf->inactive_blocked), | 269 | || !conf->inactive_blocked), |
269 | conf->device_lock, | 270 | conf->device_lock, |
270 | unplug_slaves(conf->mddev); | 271 | unplug_slaves(conf->mddev); |
@@ -1917,7 +1918,7 @@ static int run(mddev_t *mddev) | |||
1917 | goto abort; | 1918 | goto abort; |
1918 | } | 1919 | } |
1919 | } | 1920 | } |
1920 | memory = conf->max_nr_stripes * (sizeof(struct stripe_head) + | 1921 | memory = conf->max_nr_stripes * (sizeof(struct stripe_head) + |
1921 | conf->raid_disks * ((sizeof(struct bio) + PAGE_SIZE))) / 1024; | 1922 | conf->raid_disks * ((sizeof(struct bio) + PAGE_SIZE))) / 1024; |
1922 | if (grow_stripes(conf, conf->max_nr_stripes)) { | 1923 | if (grow_stripes(conf, conf->max_nr_stripes)) { |
1923 | printk(KERN_ERR | 1924 | printk(KERN_ERR |