From patchwork Tue Apr 28 02:52:42 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandra Seetharaman X-Patchwork-Id: 20312 Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3S2q9Yh023941 for ; Tue, 28 Apr 2009 02:52:09 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id 96FE3619ED2; Mon, 27 Apr 2009 22:52:08 -0400 (EDT) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n3S2q6ad008922 for ; Mon, 27 Apr 2009 22:52:06 -0400 Received: from mx3.redhat.com (mx3.redhat.com [172.16.48.32]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n3S2q5pL024326 for ; Mon, 27 Apr 2009 22:52:05 -0400 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx3.redhat.com (8.13.8/8.13.8) with ESMTP id n3S2pnEK029096 for ; Mon, 27 Apr 2009 22:51:49 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e35.co.us.ibm.com (8.13.1/8.13.1) with ESMTP id n3S2kD6E007462 for ; Mon, 27 Apr 2009 20:46:13 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n3S2pnEu086886 for ; Mon, 27 Apr 2009 20:51:49 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n3S2pnXj003157 for ; Mon, 27 Apr 2009 20:51:49 -0600 Received: from [127.0.1.1] (chandra-ubuntu.beaverton.ibm.com [9.47.17.98]) by d03av02.boulder.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n3S2pmvw003114; Mon, 27 Apr 2009 20:51:48 -0600 From: Chandra Seetharaman To: linux-scsi@vger.kernel.org Date: Mon, 27 Apr 2009 19:52:42 -0700 Message-Id: <20090428025242.11108.43024.sendpatchset@chandra-ubuntu> In-Reply-To: <20090428025230.11108.88559.sendpatchset@chandra-ubuntu> References: <20090428025230.11108.88559.sendpatchset@chandra-ubuntu> X-RedHat-Spam-Score: -3.791 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-Scanned-By: MIMEDefang 2.63 on 172.16.48.32 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, michaelc@cs.wisc.edu Subject: [dm-devel] [PATCH 2/3] scsi_dh: Remove the workqueue used for activate X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com Since scsi_dh_activate() has become an asynchronous function, we do not need a workqueue for submitting scsi_dh_activate(). This patch just removes the workqueue that submits scsi_dh_activate(). --------- Signed-off-by: Chandra Seetharaman --- drivers/md/dm-mpath.c | 51 ++++---------------------------------------------- 1 file changed, 4 insertions(+), 47 deletions(-) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel Index: linux-2.6.29/drivers/md/dm-mpath.c =================================================================== --- linux-2.6.29.orig/drivers/md/dm-mpath.c +++ linux-2.6.29/drivers/md/dm-mpath.c @@ -64,8 +64,6 @@ struct multipath { spinlock_t lock; const char *hw_handler_name; - struct work_struct activate_path; - struct pgpath *pgpath_to_activate; unsigned nr_priority_groups; struct list_head priority_groups; unsigned pg_init_required; /* pg_init needs calling? */ @@ -110,11 +108,11 @@ typedef int (*action_fn) (struct pgpath static struct kmem_cache *_mpio_cache; -static struct workqueue_struct *kmultipathd, *kmpath_handlerd; +static struct workqueue_struct *kmultipathd; static void process_queued_ios(struct work_struct *work); static void trigger_event(struct work_struct *work); -static void activate_path(struct work_struct *work); static void deactivate_path(struct work_struct *work); +static void pg_init_done(void *path, int errors); /*----------------------------------------------- @@ -160,7 +158,6 @@ static struct priority_group *alloc_prio static void free_pgpaths(struct list_head *pgpaths, struct dm_target *ti) { - unsigned long flags; struct pgpath *pgpath, *tmp; struct multipath *m = ti->private; @@ -169,10 +166,6 @@ static void free_pgpaths(struct list_hea if (m->hw_handler_name) scsi_dh_detach(bdev_get_queue(pgpath->path.dev->bdev)); dm_put_device(ti, pgpath->path.dev); - spin_lock_irqsave(&m->lock, flags); - if (m->pgpath_to_activate == pgpath) - m->pgpath_to_activate = NULL; - spin_unlock_irqrestore(&m->lock, flags); free_pgpath(pgpath); } } @@ -202,7 +195,6 @@ static struct multipath *alloc_multipath m->queue_io = 1; INIT_WORK(&m->process_queued_ios, process_queued_ios); INIT_WORK(&m->trigger_event, trigger_event); - INIT_WORK(&m->activate_path, activate_path); m->mpio_pool = mempool_create_slab_pool(MIN_IOS, _mpio_cache); if (!m->mpio_pool) { kfree(m); @@ -446,7 +438,6 @@ static void process_queued_ios(struct wo must_queue = 0; if (m->pg_init_required && !m->pg_init_in_progress && pgpath) { - m->pgpath_to_activate = pgpath; m->pg_init_count++; m->pg_init_required = 0; m->pg_init_in_progress = 1; @@ -457,7 +448,8 @@ out: spin_unlock_irqrestore(&m->lock, flags); if (init_required) - queue_work(kmpath_handlerd, &m->activate_path); + scsi_dh_activate(bdev_get_queue(pgpath->path.dev->bdev), + pg_init_done, &pgpath->path); if (!must_queue) dispatch_queued_ios(m); @@ -834,7 +826,6 @@ static void multipath_dtr(struct dm_targ { struct multipath *m = (struct multipath *) ti->private; - flush_workqueue(kmpath_handlerd); flush_workqueue(kmultipathd); free_multipath(m); } @@ -1116,24 +1107,6 @@ static void pg_init_done(void *data, int spin_unlock_irqrestore(&m->lock, flags); } -static void activate_path(struct work_struct *work) -{ - int ret; - struct multipath *m = - container_of(work, struct multipath, activate_path); - struct dm_path *path; - unsigned long flags; - - spin_lock_irqsave(&m->lock, flags); - path = &m->pgpath_to_activate->path; - m->pgpath_to_activate = NULL; - spin_unlock_irqrestore(&m->lock, flags); - if (!path) - return; - ret = scsi_dh_activate(bdev_get_queue(path->dev->bdev), - pg_init_done, path); -} - /* * end_io handling */ @@ -1471,21 +1444,6 @@ static int __init dm_multipath_init(void return -ENOMEM; } - /* - * A separate workqueue is used to handle the device handlers - * to avoid overloading existing workqueue. Overloading the - * old workqueue would also create a bottleneck in the - * path of the storage hardware device activation. - */ - kmpath_handlerd = create_singlethread_workqueue("kmpath_handlerd"); - if (!kmpath_handlerd) { - DMERR("failed to create workqueue kmpath_handlerd"); - destroy_workqueue(kmultipathd); - dm_unregister_target(&multipath_target); - kmem_cache_destroy(_mpio_cache); - return -ENOMEM; - } - DMINFO("version %u.%u.%u loaded", multipath_target.version[0], multipath_target.version[1], multipath_target.version[2]); @@ -1495,7 +1453,6 @@ static int __init dm_multipath_init(void static void __exit dm_multipath_exit(void) { - destroy_workqueue(kmpath_handlerd); destroy_workqueue(kmultipathd); dm_unregister_target(&multipath_target);