diff options
Diffstat (limited to 'drivers/md/raid5.c')
| -rw-r--r-- | drivers/md/raid5.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 4990f0319f6c..cecea901ab8c 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
| @@ -6369,6 +6369,7 @@ raid5_show_stripe_cache_size(struct mddev *mddev, char *page) | |||
| 6369 | int | 6369 | int |
| 6370 | raid5_set_cache_size(struct mddev *mddev, int size) | 6370 | raid5_set_cache_size(struct mddev *mddev, int size) |
| 6371 | { | 6371 | { |
| 6372 | int result = 0; | ||
| 6372 | struct r5conf *conf = mddev->private; | 6373 | struct r5conf *conf = mddev->private; |
| 6373 | 6374 | ||
| 6374 | if (size <= 16 || size > 32768) | 6375 | if (size <= 16 || size > 32768) |
| @@ -6385,11 +6386,14 @@ raid5_set_cache_size(struct mddev *mddev, int size) | |||
| 6385 | 6386 | ||
| 6386 | mutex_lock(&conf->cache_size_mutex); | 6387 | mutex_lock(&conf->cache_size_mutex); |
| 6387 | while (size > conf->max_nr_stripes) | 6388 | while (size > conf->max_nr_stripes) |
| 6388 | if (!grow_one_stripe(conf, GFP_KERNEL)) | 6389 | if (!grow_one_stripe(conf, GFP_KERNEL)) { |
| 6390 | conf->min_nr_stripes = conf->max_nr_stripes; | ||
| 6391 | result = -ENOMEM; | ||
| 6389 | break; | 6392 | break; |
| 6393 | } | ||
| 6390 | mutex_unlock(&conf->cache_size_mutex); | 6394 | mutex_unlock(&conf->cache_size_mutex); |
| 6391 | 6395 | ||
| 6392 | return 0; | 6396 | return result; |
| 6393 | } | 6397 | } |
| 6394 | EXPORT_SYMBOL(raid5_set_cache_size); | 6398 | EXPORT_SYMBOL(raid5_set_cache_size); |
| 6395 | 6399 | ||
