aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-04-18 04:25:42 -0400
committerNeilBrown <neilb@suse.de>2011-04-18 04:25:42 -0400
commit482c083492ddaa32ef5864bae3d143dc8bcdf7d1 (patch)
tree75017fd1a51fe945c65b3600442ddaa20b636b1a /drivers/md
parentaf1db72d8b340f97ad12b60175afdef43e6f0e60 (diff)
md - remove old plugging code.
md has some plugging infrastructure for RAID5 to use because the normal plugging infrastructure required a 'request_queue', and when called from dm, RAID5 doesn't have one of those available. This relied on the ->unplug_fn callback which doesn't exist any more. So remove all of that code, both in md and raid5. Subsequent patches with restore the plugging functionality. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c51
-rw-r--r--drivers/md/md.h22
-rw-r--r--drivers/md/raid5.c37
-rw-r--r--drivers/md/raid5.h2
4 files changed, 8 insertions, 104 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index b12b3776c0c0..fb11170c717e 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -445,50 +445,6 @@ void md_flush_request(mddev_t *mddev, struct bio *bio)
445} 445}
446EXPORT_SYMBOL(md_flush_request); 446EXPORT_SYMBOL(md_flush_request);
447 447
448/* Support for plugging.
449 * This mirrors the plugging support in request_queue, but does not
450 * require having a whole queue
451 */
452static void plugger_work(struct work_struct *work)
453{
454 struct plug_handle *plug =
455 container_of(work, struct plug_handle, unplug_work);
456 plug->unplug_fn(plug);
457}
458static void plugger_timeout(unsigned long data)
459{
460 struct plug_handle *plug = (void *)data;
461 kblockd_schedule_work(NULL, &plug->unplug_work);
462}
463void plugger_init(struct plug_handle *plug,
464 void (*unplug_fn)(struct plug_handle *))
465{
466 plug->unplug_flag = 0;
467 plug->unplug_fn = unplug_fn;
468 init_timer(&plug->unplug_timer);
469 plug->unplug_timer.function = plugger_timeout;
470 plug->unplug_timer.data = (unsigned long)plug;
471 INIT_WORK(&plug->unplug_work, plugger_work);
472}
473EXPORT_SYMBOL_GPL(plugger_init);
474
475void plugger_set_plug(struct plug_handle *plug)
476{
477 if (!test_and_set_bit(PLUGGED_FLAG, &plug->unplug_flag))
478 mod_timer(&plug->unplug_timer, jiffies + msecs_to_jiffies(3)+1);
479}
480EXPORT_SYMBOL_GPL(plugger_set_plug);
481
482int plugger_remove_plug(struct plug_handle *plug)
483{
484 if (test_and_clear_bit(PLUGGED_FLAG, &plug->unplug_flag)) {
485 del_timer(&plug->unplug_timer);
486 return 1;
487 } else
488 return 0;
489}
490EXPORT_SYMBOL_GPL(plugger_remove_plug);
491
492 448
493static inline mddev_t *mddev_get(mddev_t *mddev) 449static inline mddev_t *mddev_get(mddev_t *mddev)
494{ 450{
@@ -4723,7 +4679,6 @@ static void md_clean(mddev_t *mddev)
4723 mddev->bitmap_info.chunksize = 0; 4679 mddev->bitmap_info.chunksize = 0;
4724 mddev->bitmap_info.daemon_sleep = 0; 4680 mddev->bitmap_info.daemon_sleep = 0;
4725 mddev->bitmap_info.max_write_behind = 0; 4681 mddev->bitmap_info.max_write_behind = 0;
4726 mddev->plug = NULL;
4727} 4682}
4728 4683
4729static void __md_stop_writes(mddev_t *mddev) 4684static void __md_stop_writes(mddev_t *mddev)
@@ -6688,12 +6643,6 @@ int md_allow_write(mddev_t *mddev)
6688} 6643}
6689EXPORT_SYMBOL_GPL(md_allow_write); 6644EXPORT_SYMBOL_GPL(md_allow_write);
6690 6645
6691void md_unplug(mddev_t *mddev)
6692{
6693 if (mddev->plug)
6694 mddev->plug->unplug_fn(mddev->plug);
6695}
6696
6697#define SYNC_MARKS 10 6646#define SYNC_MARKS 10
6698#define SYNC_MARK_STEP (3*HZ) 6647#define SYNC_MARK_STEP (3*HZ)
6699void md_do_sync(mddev_t *mddev) 6648void md_do_sync(mddev_t *mddev)
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 52b407369e13..fad90228672f 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -29,26 +29,6 @@
29typedef struct mddev_s mddev_t; 29typedef struct mddev_s mddev_t;
30typedef struct mdk_rdev_s mdk_rdev_t; 30typedef struct mdk_rdev_s mdk_rdev_t;
31 31
32/* generic plugging support - like that provided with request_queue,
33 * but does not require a request_queue
34 */
35struct plug_handle {
36 void (*unplug_fn)(struct plug_handle *);
37 struct timer_list unplug_timer;
38 struct work_struct unplug_work;
39 unsigned long unplug_flag;
40};
41#define PLUGGED_FLAG 1
42void plugger_init(struct plug_handle *plug,
43 void (*unplug_fn)(struct plug_handle *));
44void plugger_set_plug(struct plug_handle *plug);
45int plugger_remove_plug(struct plug_handle *plug);
46static inline void plugger_flush(struct plug_handle *plug)
47{
48 del_timer_sync(&plug->unplug_timer);
49 cancel_work_sync(&plug->unplug_work);
50}
51
52/* 32/*
53 * MD's 'extended' device 33 * MD's 'extended' device
54 */ 34 */
@@ -336,7 +316,6 @@ struct mddev_s
336 struct list_head all_mddevs; 316 struct list_head all_mddevs;
337 317
338 struct attribute_group *to_remove; 318 struct attribute_group *to_remove;
339 struct plug_handle *plug; /* if used by personality */
340 319
341 struct bio_set *bio_set; 320 struct bio_set *bio_set;
342 321
@@ -516,7 +495,6 @@ extern int md_integrity_register(mddev_t *mddev);
516extern void md_integrity_add_rdev(mdk_rdev_t *rdev, mddev_t *mddev); 495extern void md_integrity_add_rdev(mdk_rdev_t *rdev, mddev_t *mddev);
517extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale); 496extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale);
518extern void restore_bitmap_write_access(struct file *file); 497extern void restore_bitmap_write_access(struct file *file);
519extern void md_unplug(mddev_t *mddev);
520 498
521extern void mddev_init(mddev_t *mddev); 499extern void mddev_init(mddev_t *mddev);
522extern int md_run(mddev_t *mddev); 500extern int md_run(mddev_t *mddev);
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;
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
index 8d563a4f022a..3ca77a2613ba 100644
--- a/drivers/md/raid5.h
+++ b/drivers/md/raid5.h
@@ -400,8 +400,6 @@ struct raid5_private_data {
400 * Cleared when a sync completes. 400 * Cleared when a sync completes.
401 */ 401 */
402 402
403 struct plug_handle plug;
404
405 /* per cpu variables */ 403 /* per cpu variables */
406 struct raid5_percpu { 404 struct raid5_percpu {
407 struct page *spare_page; /* Used when checking P/Q in raid6 */ 405 struct page *spare_page; /* Used when checking P/Q in raid6 */