aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r--drivers/md/raid5.c37
1 files changed, 8 insertions, 29 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index ce6960b1c682..a1755a6a3e5f 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -199,14 +199,12 @@ static void __release_stripe(raid5_conf_t *conf, struct stripe_head *sh)
199 BUG_ON(!list_empty(&sh->lru)); 199 BUG_ON(!list_empty(&sh->lru));
200 BUG_ON(atomic_read(&conf->active_stripes)==0); 200 BUG_ON(atomic_read(&conf->active_stripes)==0);
201 if (test_bit(STRIPE_HANDLE, &sh->state)) { 201 if (test_bit(STRIPE_HANDLE, &sh->state)) {
202 if (test_bit(STRIPE_DELAYED, &sh->state)) { 202 if (test_bit(STRIPE_DELAYED, &sh->state))
203 list_add_tail(&sh->lru, &conf->delayed_list); 203 list_add_tail(&sh->lru, &conf->delayed_list);
204 plugger_set_plug(&conf->plug); 204 else if (test_bit(STRIPE_BIT_DELAY, &sh->state) &&
205 } else if (test_bit(STRIPE_BIT_DELAY, &sh->state) && 205 sh->bm_seq - conf->seq_write > 0)
206 sh->bm_seq - conf->seq_write > 0) {
207 list_add_tail(&sh->lru, &conf->bitmap_list); 206 list_add_tail(&sh->lru, &conf->bitmap_list);
208 plugger_set_plug(&conf->plug); 207 else {
209 } else {
210 clear_bit(STRIPE_BIT_DELAY, &sh->state); 208 clear_bit(STRIPE_BIT_DELAY, &sh->state);
211 list_add_tail(&sh->lru, &conf->handle_list); 209 list_add_tail(&sh->lru, &conf->handle_list);
212 } 210 }
@@ -461,7 +459,7 @@ get_active_stripe(raid5_conf_t *conf, sector_t sector,
461 < (conf->max_nr_stripes *3/4) 459 < (conf->max_nr_stripes *3/4)
462 || !conf->inactive_blocked), 460 || !conf->inactive_blocked),
463 conf->device_lock, 461 conf->device_lock,
464 md_raid5_kick_device(conf)); 462 md_wakeup_thread(conf->mddev->thread));
465 conf->inactive_blocked = 0; 463 conf->inactive_blocked = 0;
466 } else 464 } else
467 init_stripe(sh, sector, previous); 465 init_stripe(sh, sector, previous);
@@ -1470,7 +1468,7 @@ static int resize_stripes(raid5_conf_t *conf, int newsize)
1470 wait_event_lock_irq(conf->wait_for_stripe, 1468 wait_event_lock_irq(conf->wait_for_stripe,
1471 !list_empty(&conf->inactive_list), 1469 !list_empty(&conf->inactive_list),
1472 conf->device_lock, 1470 conf->device_lock,
1473 blk_flush_plug(current)); 1471 );
1474 osh = get_free_stripe(conf); 1472 osh = get_free_stripe(conf);
1475 spin_unlock_irq(&conf->device_lock); 1473 spin_unlock_irq(&conf->device_lock);
1476 atomic_set(&nsh->count, 1); 1474 atomic_set(&nsh->count, 1);
@@ -3623,8 +3621,7 @@ static void raid5_activate_delayed(raid5_conf_t *conf)
3623 atomic_inc(&conf->preread_active_stripes); 3621 atomic_inc(&conf->preread_active_stripes);
3624 list_add_tail(&sh->lru, &conf->hold_list); 3622 list_add_tail(&sh->lru, &conf->hold_list);
3625 } 3623 }
3626 } else 3624 }
3627 plugger_set_plug(&conf->plug);
3628} 3625}
3629 3626
3630static void activate_bit_delay(raid5_conf_t *conf) 3627static void activate_bit_delay(raid5_conf_t *conf)
@@ -3641,21 +3638,6 @@ static void activate_bit_delay(raid5_conf_t *conf)
3641 } 3638 }
3642} 3639}
3643 3640
3644void md_raid5_kick_device(raid5_conf_t *conf)
3645{
3646 blk_flush_plug(current);
3647 raid5_activate_delayed(conf);
3648 md_wakeup_thread(conf->mddev->thread);
3649}
3650EXPORT_SYMBOL_GPL(md_raid5_kick_device);
3651
3652static void raid5_unplug(struct plug_handle *plug)
3653{
3654 raid5_conf_t *conf = container_of(plug, raid5_conf_t, plug);
3655
3656 md_raid5_kick_device(conf);
3657}
3658
3659int md_raid5_congested(mddev_t *mddev, int bits) 3641int md_raid5_congested(mddev_t *mddev, int bits)
3660{ 3642{
3661 raid5_conf_t *conf = mddev->private; 3643 raid5_conf_t *conf = mddev->private;
@@ -4057,7 +4039,7 @@ static int make_request(mddev_t *mddev, struct bio * bi)
4057 * add failed due to overlap. Flush everything 4039 * add failed due to overlap. Flush everything
4058 * and wait a while 4040 * and wait a while
4059 */ 4041 */
4060 md_raid5_kick_device(conf); 4042 md_wakeup_thread(mddev->thread);
4061 release_stripe(sh); 4043 release_stripe(sh);
4062 schedule(); 4044 schedule();
4063 goto retry; 4045 goto retry;
@@ -5144,8 +5126,6 @@ static int run(mddev_t *mddev)
5144 mdname(mddev)); 5126 mdname(mddev));
5145 md_set_array_sectors(mddev, raid5_size(mddev, 0, 0)); 5127 md_set_array_sectors(mddev, raid5_size(mddev, 0, 0));
5146 5128
5147 plugger_init(&conf->plug, raid5_unplug);
5148 mddev->plug = &conf->plug;
5149 if (mddev->queue) { 5129 if (mddev->queue) {
5150 int chunk_size; 5130 int chunk_size;
5151 /* read-ahead size must cover two whole stripes, which 5131 /* read-ahead size must cover two whole stripes, which
@@ -5195,7 +5175,6 @@ static int stop(mddev_t *mddev)
5195 mddev->thread = NULL; 5175 mddev->thread = NULL;
5196 if (mddev->queue) 5176 if (mddev->queue)
5197 mddev->queue->backing_dev_info.congested_fn = NULL; 5177 mddev->queue->backing_dev_info.congested_fn = NULL;
5198 plugger_flush(&conf->plug); /* the unplug fn references 'conf'*/
5199 free_conf(conf); 5178 free_conf(conf);
5200 mddev->private = NULL; 5179 mddev->private = NULL;
5201 mddev->to_remove = &raid5_attrs_group; 5180 mddev->to_remove = &raid5_attrs_group;