md: remove plug_cnt feature of plugging.
authorNeilBrown <neilb@suse.de>
Tue, 31 Jul 2012 07:08:14 +0000 (09:08 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 31 Jul 2012 07:08:14 +0000 (09:08 +0200)
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>
drivers/md/md.c
drivers/md/md.h
drivers/md/raid1.c
drivers/md/raid10.c
drivers/md/raid5.c

index d5ab4493c8be656ecd28227994d7f7bbe06b8e2d..34381172a9470a0ea6251ec1fc9b46b6703a5446 100644 (file)
@@ -514,8 +514,7 @@ struct md_plug_cb {
 static void plugger_unplug(struct blk_plug_cb *cb)
 {
        struct md_plug_cb *mdcb = container_of(cb, struct md_plug_cb, cb);
-       if (atomic_dec_and_test(&mdcb->mddev->plug_cnt))
-               md_wakeup_thread(mdcb->mddev->thread);
+       md_wakeup_thread(mdcb->mddev->thread);
        kfree(mdcb);
 }
 
@@ -548,7 +547,6 @@ int mddev_check_plugged(struct mddev *mddev)
 
        mdcb->mddev = mddev;
        mdcb->cb.callback = plugger_unplug;
-       atomic_inc(&mddev->plug_cnt);
        list_add(&mdcb->cb.list, &plug->cb_list);
        return 1;
 }
@@ -602,7 +600,6 @@ void mddev_init(struct mddev *mddev)
        atomic_set(&mddev->active, 1);
        atomic_set(&mddev->openers, 0);
        atomic_set(&mddev->active_io, 0);
-       atomic_set(&mddev->plug_cnt, 0);
        spin_lock_init(&mddev->write_lock);
        atomic_set(&mddev->flush_pending, 0);
        init_waitqueue_head(&mddev->sb_wait);
index 7b4a3c318cae437ecb2041c33b2bdcee2c66bf15..91786c46b85ca02a8af9c145a0e42b4b37f65856 100644 (file)
@@ -266,9 +266,6 @@ struct mddev {
        int                             new_chunk_sectors;
        int                             reshape_backwards;
 
-       atomic_t                        plug_cnt;       /* If device is expecting
-                                                        * more bios soon.
-                                                        */
        struct md_thread                *thread;        /* management thread */
        struct md_thread                *sync_thread;   /* doing resync or reconstruct */
        sector_t                        curr_resync;    /* last block scheduled */
index cacd008d68644428914b39822417209cd00dddc8..36a8fc059ac36efc068603c51348132324d5d399 100644 (file)
@@ -2173,8 +2173,7 @@ static void raid1d(struct mddev *mddev)
        blk_start_plug(&plug);
        for (;;) {
 
-               if (atomic_read(&mddev->plug_cnt) == 0)
-                       flush_pending_writes(conf);
+               flush_pending_writes(conf);
 
                spin_lock_irqsave(&conf->device_lock, flags);
                if (list_empty(head)) {
index 8da6282254c3e822a27702c469b9afce720bda43..5d33603a497d6b7a0ee53c54d51501b99c4ee2ac 100644 (file)
@@ -2660,8 +2660,7 @@ static void raid10d(struct mddev *mddev)
        blk_start_plug(&plug);
        for (;;) {
 
-               if (atomic_read(&mddev->plug_cnt) == 0)
-                       flush_pending_writes(conf);
+               flush_pending_writes(conf);
 
                spin_lock_irqsave(&conf->device_lock, flags);
                if (list_empty(head)) {
index 04348d76bb30fa8831964ea980ec2df912a45f92..bde9da2baa392d76a1ea885a136790487ccf962f 100644 (file)
@@ -4543,7 +4543,7 @@ static void raid5d(struct mddev *mddev)
        while (1) {
                struct bio *bio;
 
-               if (atomic_read(&mddev->plug_cnt) == 0 &&
+               if (
                    !list_empty(&conf->bitmap_list)) {
                        /* Now is a good time to flush some bitmap updates */
                        conf->seq_flush++;
@@ -4553,8 +4553,7 @@ static void raid5d(struct mddev *mddev)
                        conf->seq_write = conf->seq_flush;
                        activate_bit_delay(conf);
                }
-               if (atomic_read(&mddev->plug_cnt) == 0)
-                       raid5_activate_delayed(conf);
+               raid5_activate_delayed(conf);
 
                while ((bio = remove_bio_from_retry(conf))) {
                        int ok;