aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-07-25 21:57:07 -0400
committerNeilBrown <neilb@suse.de>2010-07-25 22:52:29 -0400
commit11d8a6e3719519fbc0e2c9d61b6fa931b84bf813 (patch)
tree13a075d1423b2caa3d3264db0cf8cd378c545623 /drivers/md/raid5.c
parent4a5add49951e698073011855d1a8a7306bc9308d (diff)
md/raid5: export is_congested test
the dm module will need this for dm-raid45. Also only access ->queue->backing_dev_info->congested_fn if ->queue actually exists. It won't in a dm target. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r--drivers/md/raid5.c22
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
3681static int raid5_congested(void *data, int bits) 3681int 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}
3698EXPORT_SYMBOL_GPL(md_raid5_congested);
3699
3700static 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;