diff options
author | Swen Schillig <swen@vnet.ibm.com> | 2009-08-18 09:43:17 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-09-05 09:49:23 -0400 |
commit | 4544683a4b1d4e65ccca8c736bac56a195a5206b (patch) | |
tree | 0d536db8c6820405b69768922a8a61b8d1dcf00c /drivers/s390/scsi/zfcp_aux.c | |
parent | 09a46c6e34ba152169b7400d266d2efb4c391a43 (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/s390/scsi/zfcp_aux.c')
-rw-r--r-- | drivers/s390/scsi/zfcp_aux.c | 29 |
1 files changed, 27 insertions, 2 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 | ||
459 | static 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 | |||
472 | static 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 | ||
545 | sysfs_failed: | 567 | sysfs_failed: |
568 | zfcp_destroy_adapter_work_queue(adapter); | ||
569 | work_queue_failed: | ||
546 | zfcp_adapter_debug_unregister(adapter); | 570 | zfcp_adapter_debug_unregister(adapter); |
547 | debug_register_failed: | 571 | debug_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); |