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>

NeilBrown 482c0834 af1db72d

+8 -104
-51
drivers/md/md.c
··· 445 445 } 446 446 EXPORT_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 - */ 452 - static 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 - } 458 - static void plugger_timeout(unsigned long data) 459 - { 460 - struct plug_handle *plug = (void *)data; 461 - kblockd_schedule_work(NULL, &plug->unplug_work); 462 - } 463 - void 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 - } 473 - EXPORT_SYMBOL_GPL(plugger_init); 474 - 475 - void 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 - } 480 - EXPORT_SYMBOL_GPL(plugger_set_plug); 481 - 482 - int 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 - } 490 - EXPORT_SYMBOL_GPL(plugger_remove_plug); 491 - 492 448 493 449 static inline mddev_t *mddev_get(mddev_t *mddev) 494 450 { ··· 4679 4723 mddev->bitmap_info.chunksize = 0; 4680 4724 mddev->bitmap_info.daemon_sleep = 0; 4681 4725 mddev->bitmap_info.max_write_behind = 0; 4682 - mddev->plug = NULL; 4683 4726 } 4684 4727 4685 4728 static void __md_stop_writes(mddev_t *mddev) ··· 6642 6687 return 0; 6643 6688 } 6644 6689 EXPORT_SYMBOL_GPL(md_allow_write); 6645 - 6646 - void md_unplug(mddev_t *mddev) 6647 - { 6648 - if (mddev->plug) 6649 - mddev->plug->unplug_fn(mddev->plug); 6650 - } 6651 6690 6652 6691 #define SYNC_MARKS 10 6653 6692 #define SYNC_MARK_STEP (3*HZ)
-22
drivers/md/md.h
··· 29 29 typedef struct mddev_s mddev_t; 30 30 typedef 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 - */ 35 - struct 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 42 - void plugger_init(struct plug_handle *plug, 43 - void (*unplug_fn)(struct plug_handle *)); 44 - void plugger_set_plug(struct plug_handle *plug); 45 - int plugger_remove_plug(struct plug_handle *plug); 46 - static 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 33 * MD's 'extended' device 54 34 */ ··· 316 336 struct list_head all_mddevs; 317 337 318 338 struct attribute_group *to_remove; 319 - struct plug_handle *plug; /* if used by personality */ 320 339 321 340 struct bio_set *bio_set; 322 341 ··· 495 516 extern void md_integrity_add_rdev(mdk_rdev_t *rdev, mddev_t *mddev); 496 517 extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale); 497 518 extern void restore_bitmap_write_access(struct file *file); 498 - extern void md_unplug(mddev_t *mddev); 499 519 500 520 extern void mddev_init(mddev_t *mddev); 501 521 extern int md_run(mddev_t *mddev);
+8 -29
drivers/md/raid5.c
··· 199 199 BUG_ON(!list_empty(&sh->lru)); 200 200 BUG_ON(atomic_read(&conf->active_stripes)==0); 201 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 203 list_add_tail(&sh->lru, &conf->delayed_list); 204 - plugger_set_plug(&conf->plug); 205 - } else if (test_bit(STRIPE_BIT_DELAY, &sh->state) && 206 - sh->bm_seq - conf->seq_write > 0) { 204 + else if (test_bit(STRIPE_BIT_DELAY, &sh->state) && 205 + sh->bm_seq - conf->seq_write > 0) 207 206 list_add_tail(&sh->lru, &conf->bitmap_list); 208 - plugger_set_plug(&conf->plug); 209 - } else { 207 + else { 210 208 clear_bit(STRIPE_BIT_DELAY, &sh->state); 211 209 list_add_tail(&sh->lru, &conf->handle_list); 212 210 } ··· 459 461 < (conf->max_nr_stripes *3/4) 460 462 || !conf->inactive_blocked), 461 463 conf->device_lock, 462 - md_raid5_kick_device(conf)); 464 + md_wakeup_thread(conf->mddev->thread)); 463 465 conf->inactive_blocked = 0; 464 466 } else 465 467 init_stripe(sh, sector, previous); ··· 1468 1470 wait_event_lock_irq(conf->wait_for_stripe, 1469 1471 !list_empty(&conf->inactive_list), 1470 1472 conf->device_lock, 1471 - blk_flush_plug(current)); 1473 + ); 1472 1474 osh = get_free_stripe(conf); 1473 1475 spin_unlock_irq(&conf->device_lock); 1474 1476 atomic_set(&nsh->count, 1); ··· 3621 3623 atomic_inc(&conf->preread_active_stripes); 3622 3624 list_add_tail(&sh->lru, &conf->hold_list); 3623 3625 } 3624 - } else 3625 - plugger_set_plug(&conf->plug); 3626 + } 3626 3627 } 3627 3628 3628 3629 static void activate_bit_delay(raid5_conf_t *conf) ··· 3636 3639 atomic_inc(&sh->count); 3637 3640 __release_stripe(conf, sh); 3638 3641 } 3639 - } 3640 - 3641 - void md_raid5_kick_device(raid5_conf_t *conf) 3642 - { 3643 - blk_flush_plug(current); 3644 - raid5_activate_delayed(conf); 3645 - md_wakeup_thread(conf->mddev->thread); 3646 - } 3647 - EXPORT_SYMBOL_GPL(md_raid5_kick_device); 3648 - 3649 - static void raid5_unplug(struct plug_handle *plug) 3650 - { 3651 - raid5_conf_t *conf = container_of(plug, raid5_conf_t, plug); 3652 - 3653 - md_raid5_kick_device(conf); 3654 3642 } 3655 3643 3656 3644 int md_raid5_congested(mddev_t *mddev, int bits) ··· 4039 4057 * add failed due to overlap. Flush everything 4040 4058 * and wait a while 4041 4059 */ 4042 - md_raid5_kick_device(conf); 4060 + md_wakeup_thread(mddev->thread); 4043 4061 release_stripe(sh); 4044 4062 schedule(); 4045 4063 goto retry; ··· 5126 5144 mdname(mddev)); 5127 5145 md_set_array_sectors(mddev, raid5_size(mddev, 0, 0)); 5128 5146 5129 - plugger_init(&conf->plug, raid5_unplug); 5130 - mddev->plug = &conf->plug; 5131 5147 if (mddev->queue) { 5132 5148 int chunk_size; 5133 5149 /* read-ahead size must cover two whole stripes, which ··· 5175 5195 mddev->thread = NULL; 5176 5196 if (mddev->queue) 5177 5197 mddev->queue->backing_dev_info.congested_fn = NULL; 5178 - plugger_flush(&conf->plug); /* the unplug fn references 'conf'*/ 5179 5198 free_conf(conf); 5180 5199 mddev->private = NULL; 5181 5200 mddev->to_remove = &raid5_attrs_group;
-2
drivers/md/raid5.h
··· 400 400 * Cleared when a sync completes. 401 401 */ 402 402 403 - struct plug_handle plug; 404 - 405 403 /* per cpu variables */ 406 404 struct raid5_percpu { 407 405 struct page *spare_page; /* Used when checking P/Q in raid6 */