diff options
author | NeilBrown <neilb@suse.de> | 2010-07-25 22:04:13 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-07-25 22:53:10 -0400 |
commit | 9f7c2220017771253d7d10b3cc017cb79eeac0fb (patch) | |
tree | 91e387cc225d59ac975b53590c4a75e20770b5ce /drivers/md/raid5.c | |
parent | 252ac5221a71be72b7e7c7b7482af91e9c962e8c (diff) |
md/raid5: export raid5 unplugging interface.
Also remove remaining accesses to ->queue and ->gendisk when ->queue
is NULL (As it is in a DM target).
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 0a8173e650bb..e30a809cbea0 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -434,7 +434,6 @@ static int has_failed(raid5_conf_t *conf) | |||
434 | } | 434 | } |
435 | 435 | ||
436 | static void unplug_slaves(mddev_t *mddev); | 436 | static void unplug_slaves(mddev_t *mddev); |
437 | static void raid5_unplug_device(raid5_conf_t *conf); | ||
438 | 437 | ||
439 | static struct stripe_head * | 438 | static struct stripe_head * |
440 | get_active_stripe(raid5_conf_t *conf, sector_t sector, | 439 | get_active_stripe(raid5_conf_t *conf, sector_t sector, |
@@ -464,7 +463,7 @@ get_active_stripe(raid5_conf_t *conf, sector_t sector, | |||
464 | < (conf->max_nr_stripes *3/4) | 463 | < (conf->max_nr_stripes *3/4) |
465 | || !conf->inactive_blocked), | 464 | || !conf->inactive_blocked), |
466 | conf->device_lock, | 465 | conf->device_lock, |
467 | raid5_unplug_device(conf) | 466 | md_raid5_unplug_device(conf) |
468 | ); | 467 | ); |
469 | conf->inactive_blocked = 0; | 468 | conf->inactive_blocked = 0; |
470 | } else | 469 | } else |
@@ -3659,7 +3658,7 @@ static void unplug_slaves(mddev_t *mddev) | |||
3659 | rcu_read_unlock(); | 3658 | rcu_read_unlock(); |
3660 | } | 3659 | } |
3661 | 3660 | ||
3662 | static void raid5_unplug_device(raid5_conf_t *conf) | 3661 | void md_raid5_unplug_device(raid5_conf_t *conf) |
3663 | { | 3662 | { |
3664 | unsigned long flags; | 3663 | unsigned long flags; |
3665 | 3664 | ||
@@ -3675,17 +3674,18 @@ static void raid5_unplug_device(raid5_conf_t *conf) | |||
3675 | 3674 | ||
3676 | unplug_slaves(conf->mddev); | 3675 | unplug_slaves(conf->mddev); |
3677 | } | 3676 | } |
3677 | EXPORT_SYMBOL_GPL(md_raid5_unplug_device); | ||
3678 | 3678 | ||
3679 | static void raid5_unplug(struct plug_handle *plug) | 3679 | static void raid5_unplug(struct plug_handle *plug) |
3680 | { | 3680 | { |
3681 | raid5_conf_t *conf = container_of(plug, raid5_conf_t, plug); | 3681 | raid5_conf_t *conf = container_of(plug, raid5_conf_t, plug); |
3682 | raid5_unplug_device(conf); | 3682 | md_raid5_unplug_device(conf); |
3683 | } | 3683 | } |
3684 | 3684 | ||
3685 | static void raid5_unplug_queue(struct request_queue *q) | 3685 | static void raid5_unplug_queue(struct request_queue *q) |
3686 | { | 3686 | { |
3687 | mddev_t *mddev = q->queuedata; | 3687 | mddev_t *mddev = q->queuedata; |
3688 | raid5_unplug_device(mddev->private); | 3688 | md_raid5_unplug_device(mddev->private); |
3689 | } | 3689 | } |
3690 | 3690 | ||
3691 | int md_raid5_congested(mddev_t *mddev, int bits) | 3691 | int md_raid5_congested(mddev_t *mddev, int bits) |
@@ -4095,7 +4095,7 @@ static int make_request(mddev_t *mddev, struct bio * bi) | |||
4095 | * add failed due to overlap. Flush everything | 4095 | * add failed due to overlap. Flush everything |
4096 | * and wait a while | 4096 | * and wait a while |
4097 | */ | 4097 | */ |
4098 | raid5_unplug_device(conf); | 4098 | md_raid5_unplug_device(conf); |
4099 | release_stripe(sh); | 4099 | release_stripe(sh); |
4100 | schedule(); | 4100 | schedule(); |
4101 | goto retry; | 4101 | goto retry; |
@@ -4991,7 +4991,7 @@ static int only_parity(int raid_disk, int algo, int raid_disks, int max_degraded | |||
4991 | static int run(mddev_t *mddev) | 4991 | static int run(mddev_t *mddev) |
4992 | { | 4992 | { |
4993 | raid5_conf_t *conf; | 4993 | raid5_conf_t *conf; |
4994 | int working_disks = 0, chunk_size; | 4994 | int working_disks = 0; |
4995 | int dirty_parity_disks = 0; | 4995 | int dirty_parity_disks = 0; |
4996 | mdk_rdev_t *rdev; | 4996 | mdk_rdev_t *rdev; |
4997 | sector_t reshape_offset = 0; | 4997 | sector_t reshape_offset = 0; |
@@ -5191,6 +5191,7 @@ static int run(mddev_t *mddev) | |||
5191 | plugger_init(&conf->plug, raid5_unplug); | 5191 | plugger_init(&conf->plug, raid5_unplug); |
5192 | mddev->plug = &conf->plug; | 5192 | mddev->plug = &conf->plug; |
5193 | if (mddev->queue) { | 5193 | if (mddev->queue) { |
5194 | int chunk_size; | ||
5194 | /* read-ahead size must cover two whole stripes, which | 5195 | /* read-ahead size must cover two whole stripes, which |
5195 | * is 2 * (datadisks) * chunksize where 'n' is the | 5196 | * is 2 * (datadisks) * chunksize where 'n' is the |
5196 | * number of raid devices | 5197 | * number of raid devices |
@@ -5205,20 +5206,18 @@ static int run(mddev_t *mddev) | |||
5205 | 5206 | ||
5206 | mddev->queue->backing_dev_info.congested_data = mddev; | 5207 | mddev->queue->backing_dev_info.congested_data = mddev; |
5207 | mddev->queue->backing_dev_info.congested_fn = raid5_congested; | 5208 | mddev->queue->backing_dev_info.congested_fn = raid5_congested; |
5208 | } | 5209 | mddev->queue->queue_lock = &conf->device_lock; |
5209 | 5210 | mddev->queue->unplug_fn = raid5_unplug_queue; | |
5210 | mddev->queue->queue_lock = &conf->device_lock; | ||
5211 | |||
5212 | mddev->queue->unplug_fn = raid5_unplug_queue; | ||
5213 | 5211 | ||
5214 | chunk_size = mddev->chunk_sectors << 9; | 5212 | chunk_size = mddev->chunk_sectors << 9; |
5215 | blk_queue_io_min(mddev->queue, chunk_size); | 5213 | blk_queue_io_min(mddev->queue, chunk_size); |
5216 | blk_queue_io_opt(mddev->queue, chunk_size * | 5214 | blk_queue_io_opt(mddev->queue, chunk_size * |
5217 | (conf->raid_disks - conf->max_degraded)); | 5215 | (conf->raid_disks - conf->max_degraded)); |
5218 | 5216 | ||
5219 | list_for_each_entry(rdev, &mddev->disks, same_set) | 5217 | list_for_each_entry(rdev, &mddev->disks, same_set) |
5220 | disk_stack_limits(mddev->gendisk, rdev->bdev, | 5218 | disk_stack_limits(mddev->gendisk, rdev->bdev, |
5221 | rdev->data_offset << 9); | 5219 | rdev->data_offset << 9); |
5220 | } | ||
5222 | 5221 | ||
5223 | return 0; | 5222 | return 0; |
5224 | abort: | 5223 | abort: |