aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-07-31 03:08:14 -0400
committerJens Axboe <axboe@kernel.dk>2012-07-31 03:08:14 -0400
commit0021b7bc045e4b0b85d8c53614342aaf84ca96a5 (patch)
tree1432761eec4c49bbacea55df083e73599e18ea1c
parent01ff5dbc0925d11c8ad76eed3bdd02d0c7e1e0f5 (diff)
md: remove plug_cnt feature of plugging.
This seemed like a good idea at the time, but after further thought I cannot see it making a difference other than very occasionally and testing to try to exercise the case it is most likely to help did not show any performance difference by removing it. So remove the counting of active plugs and allow 'pending writes' to be activated at any time, not just when no plugs are active. This is only relevant when there is a write-intent bitmap, and the updating of the bitmap will likely introduce enough delay that the single-threading of bitmap updates will be enough to collect large numbers of updates together. Removing this will make it easier to centralise the unplug code, and will clear the other for other unplug enhancements which have a measurable effect. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--drivers/md/md.c5
-rw-r--r--drivers/md/md.h3
-rw-r--r--drivers/md/raid1.c3
-rw-r--r--drivers/md/raid10.c3
-rw-r--r--drivers/md/raid5.c5
5 files changed, 5 insertions, 14 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index d5ab4493c8be..34381172a947 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -514,8 +514,7 @@ struct md_plug_cb {
514static void plugger_unplug(struct blk_plug_cb *cb) 514static void plugger_unplug(struct blk_plug_cb *cb)
515{ 515{
516 struct md_plug_cb *mdcb = container_of(cb, struct md_plug_cb, cb); 516 struct md_plug_cb *mdcb = container_of(cb, struct md_plug_cb, cb);
517 if (atomic_dec_and_test(&mdcb->mddev->plug_cnt)) 517 md_wakeup_thread(mdcb->mddev->thread);
518 md_wakeup_thread(mdcb->mddev->thread);
519 kfree(mdcb); 518 kfree(mdcb);
520} 519}
521 520
@@ -548,7 +547,6 @@ int mddev_check_plugged(struct mddev *mddev)
548 547
549 mdcb->mddev = mddev; 548 mdcb->mddev = mddev;
550 mdcb->cb.callback = plugger_unplug; 549 mdcb->cb.callback = plugger_unplug;
551 atomic_inc(&mddev->plug_cnt);
552 list_add(&mdcb->cb.list, &plug->cb_list); 550 list_add(&mdcb->cb.list, &plug->cb_list);
553 return 1; 551 return 1;
554} 552}
@@ -602,7 +600,6 @@ void mddev_init(struct mddev *mddev)
602 atomic_set(&mddev->active, 1); 600 atomic_set(&mddev->active, 1);
603 atomic_set(&mddev->openers, 0); 601 atomic_set(&mddev->openers, 0);
604 atomic_set(&mddev->active_io, 0); 602 atomic_set(&mddev->active_io, 0);
605 atomic_set(&mddev->plug_cnt, 0);
606 spin_lock_init(&mddev->write_lock); 603 spin_lock_init(&mddev->write_lock);
607 atomic_set(&mddev->flush_pending, 0); 604 atomic_set(&mddev->flush_pending, 0);
608 init_waitqueue_head(&mddev->sb_wait); 605 init_waitqueue_head(&mddev->sb_wait);
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 7b4a3c318cae..91786c46b85c 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -266,9 +266,6 @@ struct mddev {
266 int new_chunk_sectors; 266 int new_chunk_sectors;
267 int reshape_backwards; 267 int reshape_backwards;
268 268
269 atomic_t plug_cnt; /* If device is expecting
270 * more bios soon.
271 */
272 struct md_thread *thread; /* management thread */ 269 struct md_thread *thread; /* management thread */
273 struct md_thread *sync_thread; /* doing resync or reconstruct */ 270 struct md_thread *sync_thread; /* doing resync or reconstruct */
274 sector_t curr_resync; /* last block scheduled */ 271 sector_t curr_resync; /* last block scheduled */
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index cacd008d6864..36a8fc059ac3 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -2173,8 +2173,7 @@ static void raid1d(struct mddev *mddev)
2173 blk_start_plug(&plug); 2173 blk_start_plug(&plug);
2174 for (;;) { 2174 for (;;) {
2175 2175
2176 if (atomic_read(&mddev->plug_cnt) == 0) 2176 flush_pending_writes(conf);
2177 flush_pending_writes(conf);
2178 2177
2179 spin_lock_irqsave(&conf->device_lock, flags); 2178 spin_lock_irqsave(&conf->device_lock, flags);
2180 if (list_empty(head)) { 2179 if (list_empty(head)) {
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 8da6282254c3..5d33603a497d 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2660,8 +2660,7 @@ static void raid10d(struct mddev *mddev)
2660 blk_start_plug(&plug); 2660 blk_start_plug(&plug);
2661 for (;;) { 2661 for (;;) {
2662 2662
2663 if (atomic_read(&mddev->plug_cnt) == 0) 2663 flush_pending_writes(conf);
2664 flush_pending_writes(conf);
2665 2664
2666 spin_lock_irqsave(&conf->device_lock, flags); 2665 spin_lock_irqsave(&conf->device_lock, flags);
2667 if (list_empty(head)) { 2666 if (list_empty(head)) {
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 04348d76bb30..bde9da2baa39 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4543,7 +4543,7 @@ static void raid5d(struct mddev *mddev)
4543 while (1) { 4543 while (1) {
4544 struct bio *bio; 4544 struct bio *bio;
4545 4545
4546 if (atomic_read(&mddev->plug_cnt) == 0 && 4546 if (
4547 !list_empty(&conf->bitmap_list)) { 4547 !list_empty(&conf->bitmap_list)) {
4548 /* Now is a good time to flush some bitmap updates */ 4548 /* Now is a good time to flush some bitmap updates */
4549 conf->seq_flush++; 4549 conf->seq_flush++;
@@ -4553,8 +4553,7 @@ static void raid5d(struct mddev *mddev)
4553 conf->seq_write = conf->seq_flush; 4553 conf->seq_write = conf->seq_flush;
4554 activate_bit_delay(conf); 4554 activate_bit_delay(conf);
4555 } 4555 }
4556 if (atomic_read(&mddev->plug_cnt) == 0) 4556 raid5_activate_delayed(conf);
4557 raid5_activate_delayed(conf);
4558 4557
4559 while ((bio = remove_bio_from_retry(conf))) { 4558 while ((bio = remove_bio_from_retry(conf))) {
4560 int ok; 4559 int ok;