aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSwen Schillig <swen@vnet.ibm.com>2009-08-18 09:43:17 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-09-05 09:49:23 -0400
commit4544683a4b1d4e65ccca8c736bac56a195a5206b (patch)
tree0d536db8c6820405b69768922a8a61b8d1dcf00c /drivers
parent09a46c6e34ba152169b7400d266d2efb4c391a43 (diff)
[SCSI] zfcp: Move workqueue to adapter struct
Remove the global driver work queue and replace it with a workqueue local to the adapter. The usage of this workqueue makes this the correct place for the structure. In addition multiple adapters won't block each other due to the serialization of the queued work. Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/s390/scsi/zfcp_aux.c29
-rw-r--r--drivers/s390/scsi/zfcp_def.h2
-rw-r--r--drivers/s390/scsi/zfcp_erp.c2
-rw-r--r--drivers/s390/scsi/zfcp_fc.c2
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c2
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c5
6 files changed, 34 insertions, 8 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index de623292277b..f785cbc7520d 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -176,8 +176,6 @@ static int __init zfcp_module_init(void)
176 if (!zfcp_data.gid_pn_cache) 176 if (!zfcp_data.gid_pn_cache)
177 goto out_gid_cache; 177 goto out_gid_cache;
178 178
179 zfcp_data.work_queue = create_singlethread_workqueue("zfcp_wq");
180
181 sema_init(&zfcp_data.config_sema, 1); 179 sema_init(&zfcp_data.config_sema, 1);
182 rwlock_init(&zfcp_data.config_lock); 180 rwlock_init(&zfcp_data.config_lock);
183 181
@@ -458,6 +456,27 @@ static void zfcp_print_sl(struct seq_file *m, struct service_level *sl)
458 adapter->fsf_lic_version); 456 adapter->fsf_lic_version);
459} 457}
460 458
459static int zfcp_setup_adapter_work_queue(struct zfcp_adapter *adapter)
460{
461 char name[TASK_COMM_LEN];
462
463 snprintf(name, sizeof(name), "zfcp_q_%s",
464 dev_name(&adapter->ccw_device->dev));
465 adapter->work_queue = create_singlethread_workqueue(name);
466
467 if (adapter->work_queue)
468 return 0;
469 return -ENOMEM;
470}
471
472static void zfcp_destroy_adapter_work_queue(struct zfcp_adapter *adapter)
473{
474 if (adapter->work_queue)
475 destroy_workqueue(adapter->work_queue);
476 adapter->work_queue = NULL;
477
478}
479
461/** 480/**
462 * zfcp_adapter_enqueue - enqueue a new adapter to the list 481 * zfcp_adapter_enqueue - enqueue a new adapter to the list
463 * @ccw_device: pointer to the struct cc_device 482 * @ccw_device: pointer to the struct cc_device
@@ -504,6 +523,9 @@ int zfcp_adapter_enqueue(struct ccw_device *ccw_device)
504 if (zfcp_adapter_debug_register(adapter)) 523 if (zfcp_adapter_debug_register(adapter))
505 goto debug_register_failed; 524 goto debug_register_failed;
506 525
526 if (zfcp_setup_adapter_work_queue(adapter))
527 goto work_queue_failed;
528
507 init_waitqueue_head(&adapter->remove_wq); 529 init_waitqueue_head(&adapter->remove_wq);
508 init_waitqueue_head(&adapter->erp_thread_wqh); 530 init_waitqueue_head(&adapter->erp_thread_wqh);
509 init_waitqueue_head(&adapter->erp_done_wqh); 531 init_waitqueue_head(&adapter->erp_done_wqh);
@@ -543,6 +565,8 @@ int zfcp_adapter_enqueue(struct ccw_device *ccw_device)
543 return 0; 565 return 0;
544 566
545sysfs_failed: 567sysfs_failed:
568 zfcp_destroy_adapter_work_queue(adapter);
569work_queue_failed:
546 zfcp_adapter_debug_unregister(adapter); 570 zfcp_adapter_debug_unregister(adapter);
547debug_register_failed: 571debug_register_failed:
548 dev_set_drvdata(&ccw_device->dev, NULL); 572 dev_set_drvdata(&ccw_device->dev, NULL);
@@ -579,6 +603,7 @@ void zfcp_adapter_dequeue(struct zfcp_adapter *adapter)
579 if (!retval) 603 if (!retval)
580 return; 604 return;
581 605
606 zfcp_destroy_adapter_work_queue(adapter);
582 zfcp_adapter_debug_unregister(adapter); 607 zfcp_adapter_debug_unregister(adapter);
583 zfcp_qdio_free(adapter); 608 zfcp_qdio_free(adapter);
584 zfcp_free_low_mem_buffers(adapter); 609 zfcp_free_low_mem_buffers(adapter);
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 1e27ed5d90e0..2715a103e5a8 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -485,6 +485,7 @@ struct zfcp_adapter {
485 struct work_struct scan_work; 485 struct work_struct scan_work;
486 struct service_level service_level; 486 struct service_level service_level;
487 atomic_t qdio_outb_full; /* queue full incidents */ 487 atomic_t qdio_outb_full; /* queue full incidents */
488 struct workqueue_struct *work_queue;
488}; 489};
489 490
490struct zfcp_port { 491struct zfcp_port {
@@ -573,7 +574,6 @@ struct zfcp_data {
573 struct kmem_cache *qtcb_cache; 574 struct kmem_cache *qtcb_cache;
574 struct kmem_cache *sr_buffer_cache; 575 struct kmem_cache *sr_buffer_cache;
575 struct kmem_cache *gid_pn_cache; 576 struct kmem_cache *gid_pn_cache;
576 struct workqueue_struct *work_queue;
577}; 577};
578 578
579/********************** ZFCP SPECIFIC DEFINES ********************************/ 579/********************** ZFCP SPECIFIC DEFINES ********************************/
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index a377e2f91251..50e5fbe2252a 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -875,7 +875,7 @@ static int zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *act)
875 return zfcp_erp_open_ptp_port(act); 875 return zfcp_erp_open_ptp_port(act);
876 if (!port->d_id) { 876 if (!port->d_id) {
877 zfcp_port_get(port); 877 zfcp_port_get(port);
878 if (!queue_work(zfcp_data.work_queue, 878 if (!queue_work(adapter->work_queue,
879 &port->gid_pn_work)) 879 &port->gid_pn_work))
880 zfcp_port_put(port); 880 zfcp_port_put(port);
881 return ZFCP_ERP_CONTINUES; 881 return ZFCP_ERP_CONTINUES;
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
index acadcd3c276a..8921e16fdab7 100644
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -480,7 +480,7 @@ out:
480void zfcp_test_link(struct zfcp_port *port) 480void zfcp_test_link(struct zfcp_port *port)
481{ 481{
482 zfcp_port_get(port); 482 zfcp_port_get(port);
483 if (!queue_work(zfcp_data.work_queue, &port->test_link_work)) 483 if (!queue_work(port->adapter->work_queue, &port->test_link_work))
484 zfcp_port_put(port); 484 zfcp_port_put(port);
485} 485}
486 486
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 70a978a14f2a..5b73f989a629 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -305,7 +305,7 @@ static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req)
305 zfcp_fsf_req_free(req); 305 zfcp_fsf_req_free(req);
306 306
307 atomic_inc(&adapter->stat_miss); 307 atomic_inc(&adapter->stat_miss);
308 queue_work(zfcp_data.work_queue, &adapter->stat_work); 308 queue_work(adapter->work_queue, &adapter->stat_work);
309} 309}
310 310
311static void zfcp_fsf_fsfstatus_qual_eval(struct zfcp_fsf_req *req) 311static void zfcp_fsf_fsfstatus_qual_eval(struct zfcp_fsf_req *req)
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 0de059161b35..2e13d41269a4 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -572,7 +572,7 @@ void zfcp_scsi_schedule_rport_register(struct zfcp_port *port)
572 zfcp_port_get(port); 572 zfcp_port_get(port);
573 port->rport_task = RPORT_ADD; 573 port->rport_task = RPORT_ADD;
574 574
575 if (!queue_work(zfcp_data.work_queue, &port->rport_work)) 575 if (!queue_work(port->adapter->work_queue, &port->rport_work))
576 zfcp_port_put(port); 576 zfcp_port_put(port);
577} 577}
578 578
@@ -581,7 +581,8 @@ void zfcp_scsi_schedule_rport_block(struct zfcp_port *port)
581 zfcp_port_get(port); 581 zfcp_port_get(port);
582 port->rport_task = RPORT_DEL; 582 port->rport_task = RPORT_DEL;
583 583
584 if (port->rport && queue_work(zfcp_data.work_queue, &port->rport_work)) 584 if (port->rport && queue_work(port->adapter->work_queue,
585 &port->rport_work))
585 return; 586 return;
586 587
587 zfcp_port_put(port); 588 zfcp_port_put(port);