diff options
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 9c462f6659c3..ad6694f8a3a8 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -3678,17 +3678,14 @@ static void raid5_unplug_device(struct request_queue *q) | |||
3678 | unplug_slaves(mddev); | 3678 | unplug_slaves(mddev); |
3679 | } | 3679 | } |
3680 | 3680 | ||
3681 | static int raid5_congested(void *data, int bits) | 3681 | int md_raid5_congested(mddev_t *mddev, int bits) |
3682 | { | 3682 | { |
3683 | mddev_t *mddev = data; | ||
3684 | raid5_conf_t *conf = mddev->private; | 3683 | raid5_conf_t *conf = mddev->private; |
3685 | 3684 | ||
3686 | /* No difference between reads and writes. Just check | 3685 | /* No difference between reads and writes. Just check |
3687 | * how busy the stripe_cache is | 3686 | * how busy the stripe_cache is |
3688 | */ | 3687 | */ |
3689 | 3688 | ||
3690 | if (mddev_congested(mddev, bits)) | ||
3691 | return 1; | ||
3692 | if (conf->inactive_blocked) | 3689 | if (conf->inactive_blocked) |
3693 | return 1; | 3690 | return 1; |
3694 | if (conf->quiesce) | 3691 | if (conf->quiesce) |
@@ -3698,6 +3695,15 @@ static int raid5_congested(void *data, int bits) | |||
3698 | 3695 | ||
3699 | return 0; | 3696 | return 0; |
3700 | } | 3697 | } |
3698 | EXPORT_SYMBOL_GPL(md_raid5_congested); | ||
3699 | |||
3700 | static int raid5_congested(void *data, int bits) | ||
3701 | { | ||
3702 | mddev_t *mddev = data; | ||
3703 | |||
3704 | return mddev_congested(mddev, bits) || | ||
3705 | md_raid5_congested(mddev, bits); | ||
3706 | } | ||
3701 | 3707 | ||
3702 | /* We want read requests to align with chunks where possible, | 3708 | /* We want read requests to align with chunks where possible, |
3703 | * but write requests don't need to. | 3709 | * but write requests don't need to. |
@@ -5184,13 +5190,14 @@ static int run(mddev_t *mddev) | |||
5184 | mddev->queue->backing_dev_info.ra_pages = 2 * stripe; | 5190 | mddev->queue->backing_dev_info.ra_pages = 2 * stripe; |
5185 | 5191 | ||
5186 | blk_queue_merge_bvec(mddev->queue, raid5_mergeable_bvec); | 5192 | blk_queue_merge_bvec(mddev->queue, raid5_mergeable_bvec); |
5193 | |||
5194 | mddev->queue->backing_dev_info.congested_data = mddev; | ||
5195 | mddev->queue->backing_dev_info.congested_fn = raid5_congested; | ||
5187 | } | 5196 | } |
5188 | 5197 | ||
5189 | mddev->queue->queue_lock = &conf->device_lock; | 5198 | mddev->queue->queue_lock = &conf->device_lock; |
5190 | 5199 | ||
5191 | mddev->queue->unplug_fn = raid5_unplug_device; | 5200 | mddev->queue->unplug_fn = raid5_unplug_device; |
5192 | mddev->queue->backing_dev_info.congested_data = mddev; | ||
5193 | mddev->queue->backing_dev_info.congested_fn = raid5_congested; | ||
5194 | 5201 | ||
5195 | chunk_size = mddev->chunk_sectors << 9; | 5202 | chunk_size = mddev->chunk_sectors << 9; |
5196 | blk_queue_io_min(mddev->queue, chunk_size); | 5203 | blk_queue_io_min(mddev->queue, chunk_size); |
@@ -5220,7 +5227,8 @@ static int stop(mddev_t *mddev) | |||
5220 | 5227 | ||
5221 | md_unregister_thread(mddev->thread); | 5228 | md_unregister_thread(mddev->thread); |
5222 | mddev->thread = NULL; | 5229 | mddev->thread = NULL; |
5223 | mddev->queue->backing_dev_info.congested_fn = NULL; | 5230 | if (mddev->queue) |
5231 | mddev->queue->backing_dev_info.congested_fn = NULL; | ||
5224 | blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ | 5232 | blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ |
5225 | free_conf(conf); | 5233 | free_conf(conf); |
5226 | mddev->private = NULL; | 5234 | mddev->private = NULL; |