aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2008-10-01 06:42:20 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-10-03 13:11:54 -0400
commit0406289ed57955860a4f8d744a14f4c819260ce4 (patch)
treebe91ef3d51f3108469d74c1fa36d10c914ce4c6d /drivers/s390
parenta1b449de5d35b9eec8981c6ea999eea263b19a0b (diff)
[SCSI] zfcp: Simplify zfcp data structures
Reduce the size of zfcp data structures by removing unused and redundant members. scsi_lun is only the mangled version of the fcp_lun. So, remove the redundant field and use the fcp_lun instead. Since the queue lock and the pci_batch indicator are only used in the request queue, move them from the common queue struct to the adapter struct. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/scsi/zfcp_aux.c34
-rw-r--r--drivers/s390/scsi/zfcp_ccw.c10
-rw-r--r--drivers/s390/scsi/zfcp_def.h26
-rw-r--r--drivers/s390/scsi/zfcp_erp.c2
-rw-r--r--drivers/s390/scsi/zfcp_fc.c3
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c89
-rw-r--r--drivers/s390/scsi/zfcp_qdio.c12
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c8
-rw-r--r--drivers/s390/scsi/zfcp_sysfs.c6
9 files changed, 77 insertions, 113 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 6397de01b85e..b9984648aca6 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -169,8 +169,6 @@ static int __init zfcp_module_init(void)
169 goto out_gid_cache; 169 goto out_gid_cache;
170 170
171 INIT_LIST_HEAD(&zfcp_data.adapter_list_head); 171 INIT_LIST_HEAD(&zfcp_data.adapter_list_head);
172 INIT_LIST_HEAD(&zfcp_data.adapter_remove_lh);
173
174 sema_init(&zfcp_data.config_sema, 1); 172 sema_init(&zfcp_data.config_sema, 1);
175 rwlock_init(&zfcp_data.config_lock); 173 rwlock_init(&zfcp_data.config_lock);
176 174
@@ -312,7 +310,6 @@ struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *port, u64 fcp_lun)
312 } 310 }
313 311
314 zfcp_unit_get(unit); 312 zfcp_unit_get(unit);
315 unit->scsi_lun = scsilun_to_int((struct scsi_lun *)&unit->fcp_lun);
316 313
317 write_lock_irq(&zfcp_data.config_lock); 314 write_lock_irq(&zfcp_data.config_lock);
318 list_add_tail(&unit->list, &port->unit_list_head); 315 list_add_tail(&unit->list, &port->unit_list_head);
@@ -321,7 +318,6 @@ struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *port, u64 fcp_lun)
321 318
322 write_unlock_irq(&zfcp_data.config_lock); 319 write_unlock_irq(&zfcp_data.config_lock);
323 320
324 port->units++;
325 zfcp_port_get(port); 321 zfcp_port_get(port);
326 322
327 return unit; 323 return unit;
@@ -344,7 +340,6 @@ void zfcp_unit_dequeue(struct zfcp_unit *unit)
344 write_lock_irq(&zfcp_data.config_lock); 340 write_lock_irq(&zfcp_data.config_lock);
345 list_del(&unit->list); 341 list_del(&unit->list);
346 write_unlock_irq(&zfcp_data.config_lock); 342 write_unlock_irq(&zfcp_data.config_lock);
347 unit->port->units--;
348 zfcp_port_put(unit->port); 343 zfcp_port_put(unit->port);
349 sysfs_remove_group(&unit->sysfs_device.kobj, &zfcp_sysfs_unit_attrs); 344 sysfs_remove_group(&unit->sysfs_device.kobj, &zfcp_sysfs_unit_attrs);
350 device_unregister(&unit->sysfs_device); 345 device_unregister(&unit->sysfs_device);
@@ -405,11 +400,6 @@ static void zfcp_free_low_mem_buffers(struct zfcp_adapter *adapter)
405 mempool_destroy(adapter->pool.data_gid_pn); 400 mempool_destroy(adapter->pool.data_gid_pn);
406} 401}
407 402
408static void zfcp_dummy_release(struct device *dev)
409{
410 return;
411}
412
413/** 403/**
414 * zfcp_status_read_refill - refill the long running status_read_requests 404 * zfcp_status_read_refill - refill the long running status_read_requests
415 * @adapter: ptr to struct zfcp_adapter for which the buffers should be refilled 405 * @adapter: ptr to struct zfcp_adapter for which the buffers should be refilled
@@ -484,7 +474,6 @@ int zfcp_adapter_enqueue(struct ccw_device *ccw_device)
484 init_waitqueue_head(&adapter->erp_done_wqh); 474 init_waitqueue_head(&adapter->erp_done_wqh);
485 475
486 INIT_LIST_HEAD(&adapter->port_list_head); 476 INIT_LIST_HEAD(&adapter->port_list_head);
487 INIT_LIST_HEAD(&adapter->port_remove_lh);
488 INIT_LIST_HEAD(&adapter->erp_ready_head); 477 INIT_LIST_HEAD(&adapter->erp_ready_head);
489 INIT_LIST_HEAD(&adapter->erp_running_head); 478 INIT_LIST_HEAD(&adapter->erp_running_head);
490 479
@@ -494,7 +483,7 @@ int zfcp_adapter_enqueue(struct ccw_device *ccw_device)
494 spin_lock_init(&adapter->san_dbf_lock); 483 spin_lock_init(&adapter->san_dbf_lock);
495 spin_lock_init(&adapter->scsi_dbf_lock); 484 spin_lock_init(&adapter->scsi_dbf_lock);
496 spin_lock_init(&adapter->rec_dbf_lock); 485 spin_lock_init(&adapter->rec_dbf_lock);
497 spin_lock_init(&adapter->req_q.lock); 486 spin_lock_init(&adapter->req_q_lock);
498 487
499 rwlock_init(&adapter->erp_lock); 488 rwlock_init(&adapter->erp_lock);
500 rwlock_init(&adapter->abort_lock); 489 rwlock_init(&adapter->abort_lock);
@@ -513,28 +502,15 @@ int zfcp_adapter_enqueue(struct ccw_device *ccw_device)
513 &zfcp_sysfs_adapter_attrs)) 502 &zfcp_sysfs_adapter_attrs))
514 goto sysfs_failed; 503 goto sysfs_failed;
515 504
516 adapter->generic_services.parent = &adapter->ccw_device->dev;
517 adapter->generic_services.release = zfcp_dummy_release;
518 snprintf(adapter->generic_services.bus_id, BUS_ID_SIZE,
519 "generic_services");
520
521 if (device_register(&adapter->generic_services))
522 goto generic_services_failed;
523
524 write_lock_irq(&zfcp_data.config_lock); 505 write_lock_irq(&zfcp_data.config_lock);
525 atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, &adapter->status); 506 atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, &adapter->status);
526 list_add_tail(&adapter->list, &zfcp_data.adapter_list_head); 507 list_add_tail(&adapter->list, &zfcp_data.adapter_list_head);
527 write_unlock_irq(&zfcp_data.config_lock); 508 write_unlock_irq(&zfcp_data.config_lock);
528 509
529 zfcp_data.adapters++;
530
531 zfcp_fc_nameserver_init(adapter); 510 zfcp_fc_nameserver_init(adapter);
532 511
533 return 0; 512 return 0;
534 513
535generic_services_failed:
536 sysfs_remove_group(&ccw_device->dev.kobj,
537 &zfcp_sysfs_adapter_attrs);
538sysfs_failed: 514sysfs_failed:
539 zfcp_adapter_debug_unregister(adapter); 515 zfcp_adapter_debug_unregister(adapter);
540debug_register_failed: 516debug_register_failed:
@@ -561,7 +537,6 @@ void zfcp_adapter_dequeue(struct zfcp_adapter *adapter)
561 cancel_work_sync(&adapter->scan_work); 537 cancel_work_sync(&adapter->scan_work);
562 cancel_work_sync(&adapter->stat_work); 538 cancel_work_sync(&adapter->stat_work);
563 zfcp_adapter_scsi_unregister(adapter); 539 zfcp_adapter_scsi_unregister(adapter);
564 device_unregister(&adapter->generic_services);
565 sysfs_remove_group(&adapter->ccw_device->dev.kobj, 540 sysfs_remove_group(&adapter->ccw_device->dev.kobj,
566 &zfcp_sysfs_adapter_attrs); 541 &zfcp_sysfs_adapter_attrs);
567 dev_set_drvdata(&adapter->ccw_device->dev, NULL); 542 dev_set_drvdata(&adapter->ccw_device->dev, NULL);
@@ -579,9 +554,6 @@ void zfcp_adapter_dequeue(struct zfcp_adapter *adapter)
579 list_del(&adapter->list); 554 list_del(&adapter->list);
580 write_unlock_irq(&zfcp_data.config_lock); 555 write_unlock_irq(&zfcp_data.config_lock);
581 556
582 /* decrease number of adapters in list */
583 zfcp_data.adapters--;
584
585 zfcp_qdio_free(adapter); 557 zfcp_qdio_free(adapter);
586 558
587 zfcp_free_low_mem_buffers(adapter); 559 zfcp_free_low_mem_buffers(adapter);
@@ -620,9 +592,7 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn,
620 return ERR_PTR(-ENOMEM); 592 return ERR_PTR(-ENOMEM);
621 593
622 init_waitqueue_head(&port->remove_wq); 594 init_waitqueue_head(&port->remove_wq);
623
624 INIT_LIST_HEAD(&port->unit_list_head); 595 INIT_LIST_HEAD(&port->unit_list_head);
625 INIT_LIST_HEAD(&port->unit_remove_lh);
626 INIT_WORK(&port->gid_pn_work, zfcp_erp_port_strategy_open_lookup); 596 INIT_WORK(&port->gid_pn_work, zfcp_erp_port_strategy_open_lookup);
627 597
628 port->adapter = adapter; 598 port->adapter = adapter;
@@ -665,7 +635,6 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn,
665 list_add_tail(&port->list, &adapter->port_list_head); 635 list_add_tail(&port->list, &adapter->port_list_head);
666 atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status); 636 atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status);
667 atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING, &port->status); 637 atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING, &port->status);
668 adapter->ports++;
669 638
670 write_unlock_irq(&zfcp_data.config_lock); 639 write_unlock_irq(&zfcp_data.config_lock);
671 640
@@ -687,7 +656,6 @@ void zfcp_port_dequeue(struct zfcp_port *port)
687 wait_event(port->remove_wq, atomic_read(&port->refcount) == 0); 656 wait_event(port->remove_wq, atomic_read(&port->refcount) == 0);
688 write_lock_irq(&zfcp_data.config_lock); 657 write_lock_irq(&zfcp_data.config_lock);
689 list_del(&port->list); 658 list_del(&port->list);
690 port->adapter->ports--;
691 write_unlock_irq(&zfcp_data.config_lock); 659 write_unlock_irq(&zfcp_data.config_lock);
692 if (port->rport) 660 if (port->rport)
693 fc_remote_port_delete(port->rport); 661 fc_remote_port_delete(port->rport);
diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c
index 3a9bd5451a49..b04038c74786 100644
--- a/drivers/s390/scsi/zfcp_ccw.c
+++ b/drivers/s390/scsi/zfcp_ccw.c
@@ -47,6 +47,8 @@ static void zfcp_ccw_remove(struct ccw_device *ccw_device)
47 struct zfcp_adapter *adapter; 47 struct zfcp_adapter *adapter;
48 struct zfcp_port *port, *p; 48 struct zfcp_port *port, *p;
49 struct zfcp_unit *unit, *u; 49 struct zfcp_unit *unit, *u;
50 LIST_HEAD(unit_remove_lh);
51 LIST_HEAD(port_remove_lh);
50 52
51 ccw_device_set_offline(ccw_device); 53 ccw_device_set_offline(ccw_device);
52 down(&zfcp_data.config_sema); 54 down(&zfcp_data.config_sema);
@@ -55,18 +57,18 @@ static void zfcp_ccw_remove(struct ccw_device *ccw_device)
55 write_lock_irq(&zfcp_data.config_lock); 57 write_lock_irq(&zfcp_data.config_lock);
56 list_for_each_entry_safe(port, p, &adapter->port_list_head, list) { 58 list_for_each_entry_safe(port, p, &adapter->port_list_head, list) {
57 list_for_each_entry_safe(unit, u, &port->unit_list_head, list) { 59 list_for_each_entry_safe(unit, u, &port->unit_list_head, list) {
58 list_move(&unit->list, &port->unit_remove_lh); 60 list_move(&unit->list, &unit_remove_lh);
59 atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, 61 atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE,
60 &unit->status); 62 &unit->status);
61 } 63 }
62 list_move(&port->list, &adapter->port_remove_lh); 64 list_move(&port->list, &port_remove_lh);
63 atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status); 65 atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status);
64 } 66 }
65 atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &adapter->status); 67 atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &adapter->status);
66 write_unlock_irq(&zfcp_data.config_lock); 68 write_unlock_irq(&zfcp_data.config_lock);
67 69
68 list_for_each_entry_safe(port, p, &adapter->port_remove_lh, list) { 70 list_for_each_entry_safe(port, p, &port_remove_lh, list) {
69 list_for_each_entry_safe(unit, u, &port->unit_remove_lh, list) { 71 list_for_each_entry_safe(unit, u, &unit_remove_lh, list) {
70 if (atomic_read(&unit->status) & 72 if (atomic_read(&unit->status) &
71 ZFCP_STATUS_UNIT_REGISTERED) 73 ZFCP_STATUS_UNIT_REGISTERED)
72 scsi_remove_device(unit->device); 74 scsi_remove_device(unit->device);
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index cbbfd875d939..7fa8937c8c58 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -412,14 +412,9 @@ struct zfcp_wka_port {
412}; 412};
413 413
414struct zfcp_qdio_queue { 414struct zfcp_qdio_queue {
415 struct qdio_buffer *sbal[QDIO_MAX_BUFFERS_PER_Q]; /* SBALs */ 415 struct qdio_buffer *sbal[QDIO_MAX_BUFFERS_PER_Q];
416 u8 first; /* index of next free bfr 416 u8 first; /* index of next free bfr in queue */
417 in queue (free_count>0) */ 417 atomic_t count; /* number of free buffers in queue */
418 atomic_t count; /* number of free buffers
419 in queue */
420 spinlock_t lock; /* lock for operations on queue */
421 int pci_batch; /* SBALs since PCI indication
422 was last set */
423}; 418};
424 419
425struct zfcp_erp_action { 420struct zfcp_erp_action {
@@ -471,13 +466,13 @@ struct zfcp_adapter {
471 u16 timer_ticks; /* time int for a tick */ 466 u16 timer_ticks; /* time int for a tick */
472 struct Scsi_Host *scsi_host; /* Pointer to mid-layer */ 467 struct Scsi_Host *scsi_host; /* Pointer to mid-layer */
473 struct list_head port_list_head; /* remote port list */ 468 struct list_head port_list_head; /* remote port list */
474 struct list_head port_remove_lh; /* head of ports to be
475 removed */
476 u32 ports; /* number of remote ports */
477 unsigned long req_no; /* unique FSF req number */ 469 unsigned long req_no; /* unique FSF req number */
478 struct list_head *req_list; /* list of pending reqs */ 470 struct list_head *req_list; /* list of pending reqs */
479 spinlock_t req_list_lock; /* request list lock */ 471 spinlock_t req_list_lock; /* request list lock */
480 struct zfcp_qdio_queue req_q; /* request queue */ 472 struct zfcp_qdio_queue req_q; /* request queue */
473 spinlock_t req_q_lock; /* for operations on queue */
474 int req_q_pci_batch; /* SBALs since PCI indication
475 was last set */
481 u32 fsf_req_seq_no; /* FSF cmnd seq number */ 476 u32 fsf_req_seq_no; /* FSF cmnd seq number */
482 wait_queue_head_t request_wq; /* can be used to wait for 477 wait_queue_head_t request_wq; /* can be used to wait for
483 more avaliable SBALs */ 478 more avaliable SBALs */
@@ -516,7 +511,6 @@ struct zfcp_adapter {
516 struct zfcp_scsi_dbf_record scsi_dbf_buf; 511 struct zfcp_scsi_dbf_record scsi_dbf_buf;
517 struct zfcp_adapter_mempool pool; /* Adapter memory pools */ 512 struct zfcp_adapter_mempool pool; /* Adapter memory pools */
518 struct qdio_initialize qdio_init_data; /* for qdio_establish */ 513 struct qdio_initialize qdio_init_data; /* for qdio_establish */
519 struct device generic_services; /* directory for WKA ports */
520 struct fc_host_statistics *fc_stats; 514 struct fc_host_statistics *fc_stats;
521 struct fsf_qtcb_bottom_port *stats_reset_data; 515 struct fsf_qtcb_bottom_port *stats_reset_data;
522 unsigned long stats_reset; 516 unsigned long stats_reset;
@@ -533,9 +527,6 @@ struct zfcp_port {
533 refcount drop to zero */ 527 refcount drop to zero */
534 struct zfcp_adapter *adapter; /* adapter used to access port */ 528 struct zfcp_adapter *adapter; /* adapter used to access port */
535 struct list_head unit_list_head; /* head of logical unit list */ 529 struct list_head unit_list_head; /* head of logical unit list */
536 struct list_head unit_remove_lh; /* head of luns to be removed
537 list */
538 u32 units; /* # of logical units in list */
539 atomic_t status; /* status of this remote port */ 530 atomic_t status; /* status of this remote port */
540 u64 wwnn; /* WWNN if known */ 531 u64 wwnn; /* WWNN if known */
541 u64 wwpn; /* WWPN */ 532 u64 wwpn; /* WWPN */
@@ -556,7 +547,6 @@ struct zfcp_unit {
556 refcount drop to zero */ 547 refcount drop to zero */
557 struct zfcp_port *port; /* remote port of unit */ 548 struct zfcp_port *port; /* remote port of unit */
558 atomic_t status; /* status of this logical unit */ 549 atomic_t status; /* status of this logical unit */
559 unsigned int scsi_lun; /* own SCSI LUN */
560 u64 fcp_lun; /* own FCP_LUN */ 550 u64 fcp_lun; /* own FCP_LUN */
561 u32 handle; /* handle assigned by FSF */ 551 u32 handle; /* handle assigned by FSF */
562 struct scsi_device *device; /* scsi device struct pointer */ 552 struct scsi_device *device; /* scsi device struct pointer */
@@ -599,11 +589,7 @@ struct zfcp_fsf_req {
599struct zfcp_data { 589struct zfcp_data {
600 struct scsi_host_template scsi_host_template; 590 struct scsi_host_template scsi_host_template;
601 struct scsi_transport_template *scsi_transport_template; 591 struct scsi_transport_template *scsi_transport_template;
602 atomic_t status; /* Module status flags */
603 struct list_head adapter_list_head; /* head of adapter list */ 592 struct list_head adapter_list_head; /* head of adapter list */
604 struct list_head adapter_remove_lh; /* head of adapters to be
605 removed */
606 u32 adapters; /* # of adapters in list */
607 rwlock_t config_lock; /* serialises changes 593 rwlock_t config_lock; /* serialises changes
608 to adapter/port/unit 594 to adapter/port/unit
609 lists */ 595 lists */
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 07d22f343cc5..174b38fe7623 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -1186,7 +1186,7 @@ static void zfcp_erp_scsi_scan(struct work_struct *work)
1186 struct zfcp_unit *unit = p->unit; 1186 struct zfcp_unit *unit = p->unit;
1187 struct fc_rport *rport = unit->port->rport; 1187 struct fc_rport *rport = unit->port->rport;
1188 scsi_scan_target(&rport->dev, 0, rport->scsi_target_id, 1188 scsi_scan_target(&rport->dev, 0, rport->scsi_target_id,
1189 unit->scsi_lun, 0); 1189 scsilun_to_int((struct scsi_lun *)&unit->fcp_lun), 0);
1190 atomic_clear_mask(ZFCP_STATUS_UNIT_SCSI_WORK_PENDING, &unit->status); 1190 atomic_clear_mask(ZFCP_STATUS_UNIT_SCSI_WORK_PENDING, &unit->status);
1191 zfcp_unit_put(unit); 1191 zfcp_unit_put(unit);
1192 kfree(p); 1192 kfree(p);
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
index 3a573b03eb86..1a7c80a77ff5 100644
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -526,7 +526,8 @@ static void zfcp_validate_port(struct zfcp_port *port)
526 526
527 atomic_clear_mask(ZFCP_STATUS_COMMON_NOESC, &port->status); 527 atomic_clear_mask(ZFCP_STATUS_COMMON_NOESC, &port->status);
528 528
529 if ((port->supported_classes != 0) || (port->units != 0)) { 529 if ((port->supported_classes != 0) ||
530 !list_empty(&port->unit_list_head)) {
530 zfcp_port_put(port); 531 zfcp_port_put(port);
531 return; 532 return;
532 } 533 }
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 02a570084d88..c10b88d235d2 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -639,12 +639,14 @@ static void zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *req)
639 } 639 }
640} 640}
641 641
642static int zfcp_fsf_sbal_check(struct zfcp_qdio_queue *queue) 642static int zfcp_fsf_sbal_check(struct zfcp_adapter *adapter)
643{ 643{
644 spin_lock_bh(&queue->lock); 644 struct zfcp_qdio_queue *req_q = &adapter->req_q;
645 if (atomic_read(&queue->count)) 645
646 spin_lock_bh(&adapter->req_q_lock);
647 if (atomic_read(&req_q->count))
646 return 1; 648 return 1;
647 spin_unlock_bh(&queue->lock); 649 spin_unlock_bh(&adapter->req_q_lock);
648 return 0; 650 return 0;
649} 651}
650 652
@@ -659,17 +661,16 @@ static int zfcp_fsf_sbal_available(struct zfcp_adapter *adapter)
659static int zfcp_fsf_req_sbal_get(struct zfcp_adapter *adapter) 661static int zfcp_fsf_req_sbal_get(struct zfcp_adapter *adapter)
660{ 662{
661 long ret; 663 long ret;
662 struct zfcp_qdio_queue *req_q = &adapter->req_q;
663 664
664 spin_unlock_bh(&req_q->lock); 665 spin_unlock_bh(&adapter->req_q_lock);
665 ret = wait_event_interruptible_timeout(adapter->request_wq, 666 ret = wait_event_interruptible_timeout(adapter->request_wq,
666 zfcp_fsf_sbal_check(req_q), 5 * HZ); 667 zfcp_fsf_sbal_check(adapter), 5 * HZ);
667 if (ret > 0) 668 if (ret > 0)
668 return 0; 669 return 0;
669 if (!ret) 670 if (!ret)
670 atomic_inc(&adapter->qdio_outb_full); 671 atomic_inc(&adapter->qdio_outb_full);
671 672
672 spin_lock_bh(&req_q->lock); 673 spin_lock_bh(&adapter->req_q_lock);
673 return -EIO; 674 return -EIO;
674} 675}
675 676
@@ -811,7 +812,7 @@ int zfcp_fsf_status_read(struct zfcp_adapter *adapter)
811 struct qdio_buffer_element *sbale; 812 struct qdio_buffer_element *sbale;
812 int retval = -EIO; 813 int retval = -EIO;
813 814
814 spin_lock_bh(&adapter->req_q.lock); 815 spin_lock_bh(&adapter->req_q_lock);
815 if (zfcp_fsf_req_sbal_get(adapter)) 816 if (zfcp_fsf_req_sbal_get(adapter))
816 goto out; 817 goto out;
817 818
@@ -851,7 +852,7 @@ failed_buf:
851 zfcp_fsf_req_free(req); 852 zfcp_fsf_req_free(req);
852 zfcp_hba_dbf_event_fsf_unsol("fail", adapter, NULL); 853 zfcp_hba_dbf_event_fsf_unsol("fail", adapter, NULL);
853out: 854out:
854 spin_unlock_bh(&adapter->req_q.lock); 855 spin_unlock_bh(&adapter->req_q_lock);
855 return retval; 856 return retval;
856} 857}
857 858
@@ -924,7 +925,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_command(unsigned long old_req_id,
924 struct qdio_buffer_element *sbale; 925 struct qdio_buffer_element *sbale;
925 struct zfcp_fsf_req *req = NULL; 926 struct zfcp_fsf_req *req = NULL;
926 927
927 spin_lock(&adapter->req_q.lock); 928 spin_lock(&adapter->req_q_lock);
928 if (!zfcp_fsf_sbal_available(adapter)) 929 if (!zfcp_fsf_sbal_available(adapter))
929 goto out; 930 goto out;
930 req = zfcp_fsf_req_create(adapter, FSF_QTCB_ABORT_FCP_CMND, 931 req = zfcp_fsf_req_create(adapter, FSF_QTCB_ABORT_FCP_CMND,
@@ -954,7 +955,7 @@ out_error_free:
954 zfcp_fsf_req_free(req); 955 zfcp_fsf_req_free(req);
955 req = NULL; 956 req = NULL;
956out: 957out:
957 spin_unlock(&adapter->req_q.lock); 958 spin_unlock(&adapter->req_q_lock);
958 return req; 959 return req;
959} 960}
960 961
@@ -1043,7 +1044,7 @@ int zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool,
1043 struct zfcp_fsf_req *req; 1044 struct zfcp_fsf_req *req;
1044 int ret = -EIO; 1045 int ret = -EIO;
1045 1046
1046 spin_lock_bh(&adapter->req_q.lock); 1047 spin_lock_bh(&adapter->req_q_lock);
1047 if (zfcp_fsf_req_sbal_get(adapter)) 1048 if (zfcp_fsf_req_sbal_get(adapter))
1048 goto out; 1049 goto out;
1049 1050
@@ -1085,7 +1086,7 @@ failed_send:
1085 if (erp_action) 1086 if (erp_action)
1086 erp_action->fsf_req = NULL; 1087 erp_action->fsf_req = NULL;
1087out: 1088out:
1088 spin_unlock_bh(&adapter->req_q.lock); 1089 spin_unlock_bh(&adapter->req_q_lock);
1089 return ret; 1090 return ret;
1090} 1091}
1091 1092
@@ -1155,7 +1156,7 @@ int zfcp_fsf_send_els(struct zfcp_send_els *els)
1155 ZFCP_STATUS_COMMON_UNBLOCKED))) 1156 ZFCP_STATUS_COMMON_UNBLOCKED)))
1156 return -EBUSY; 1157 return -EBUSY;
1157 1158
1158 spin_lock(&adapter->req_q.lock); 1159 spin_lock(&adapter->req_q_lock);
1159 if (!zfcp_fsf_sbal_available(adapter)) 1160 if (!zfcp_fsf_sbal_available(adapter))
1160 goto out; 1161 goto out;
1161 req = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_ELS, 1162 req = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_ELS,
@@ -1189,7 +1190,7 @@ int zfcp_fsf_send_els(struct zfcp_send_els *els)
1189failed_send: 1190failed_send:
1190 zfcp_fsf_req_free(req); 1191 zfcp_fsf_req_free(req);
1191out: 1192out:
1192 spin_unlock(&adapter->req_q.lock); 1193 spin_unlock(&adapter->req_q_lock);
1193 return ret; 1194 return ret;
1194} 1195}
1195 1196
@@ -1200,7 +1201,7 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
1200 struct zfcp_adapter *adapter = erp_action->adapter; 1201 struct zfcp_adapter *adapter = erp_action->adapter;
1201 int retval = -EIO; 1202 int retval = -EIO;
1202 1203
1203 spin_lock_bh(&adapter->req_q.lock); 1204 spin_lock_bh(&adapter->req_q_lock);
1204 if (!zfcp_fsf_sbal_available(adapter)) 1205 if (!zfcp_fsf_sbal_available(adapter))
1205 goto out; 1206 goto out;
1206 req = zfcp_fsf_req_create(adapter, 1207 req = zfcp_fsf_req_create(adapter,
@@ -1232,7 +1233,7 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
1232 erp_action->fsf_req = NULL; 1233 erp_action->fsf_req = NULL;
1233 } 1234 }
1234out: 1235out:
1235 spin_unlock_bh(&adapter->req_q.lock); 1236 spin_unlock_bh(&adapter->req_q_lock);
1236 return retval; 1237 return retval;
1237} 1238}
1238 1239
@@ -1243,7 +1244,7 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_adapter *adapter,
1243 struct zfcp_fsf_req *req = NULL; 1244 struct zfcp_fsf_req *req = NULL;
1244 int retval = -EIO; 1245 int retval = -EIO;
1245 1246
1246 spin_lock_bh(&adapter->req_q.lock); 1247 spin_lock_bh(&adapter->req_q_lock);
1247 if (zfcp_fsf_req_sbal_get(adapter)) 1248 if (zfcp_fsf_req_sbal_get(adapter))
1248 goto out; 1249 goto out;
1249 1250
@@ -1271,7 +1272,7 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_adapter *adapter,
1271 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); 1272 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
1272 retval = zfcp_fsf_req_send(req); 1273 retval = zfcp_fsf_req_send(req);
1273out: 1274out:
1274 spin_unlock_bh(&adapter->req_q.lock); 1275 spin_unlock_bh(&adapter->req_q_lock);
1275 if (!retval) 1276 if (!retval)
1276 wait_event(req->completion_wq, 1277 wait_event(req->completion_wq,
1277 req->status & ZFCP_STATUS_FSFREQ_COMPLETED); 1278 req->status & ZFCP_STATUS_FSFREQ_COMPLETED);
@@ -1296,7 +1297,7 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
1296 if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) 1297 if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT))
1297 return -EOPNOTSUPP; 1298 return -EOPNOTSUPP;
1298 1299
1299 spin_lock_bh(&adapter->req_q.lock); 1300 spin_lock_bh(&adapter->req_q_lock);
1300 if (!zfcp_fsf_sbal_available(adapter)) 1301 if (!zfcp_fsf_sbal_available(adapter))
1301 goto out; 1302 goto out;
1302 req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, 1303 req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA,
@@ -1322,7 +1323,7 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
1322 erp_action->fsf_req = NULL; 1323 erp_action->fsf_req = NULL;
1323 } 1324 }
1324out: 1325out:
1325 spin_unlock_bh(&adapter->req_q.lock); 1326 spin_unlock_bh(&adapter->req_q_lock);
1326 return retval; 1327 return retval;
1327} 1328}
1328 1329
@@ -1342,7 +1343,7 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_adapter *adapter,
1342 if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) 1343 if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT))
1343 return -EOPNOTSUPP; 1344 return -EOPNOTSUPP;
1344 1345
1345 spin_lock_bh(&adapter->req_q.lock); 1346 spin_lock_bh(&adapter->req_q_lock);
1346 if (!zfcp_fsf_sbal_available(adapter)) 1347 if (!zfcp_fsf_sbal_available(adapter))
1347 goto out; 1348 goto out;
1348 1349
@@ -1364,7 +1365,7 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_adapter *adapter,
1364 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); 1365 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
1365 retval = zfcp_fsf_req_send(req); 1366 retval = zfcp_fsf_req_send(req);
1366out: 1367out:
1367 spin_unlock_bh(&adapter->req_q.lock); 1368 spin_unlock_bh(&adapter->req_q_lock);
1368 if (!retval) 1369 if (!retval)
1369 wait_event(req->completion_wq, 1370 wait_event(req->completion_wq,
1370 req->status & ZFCP_STATUS_FSFREQ_COMPLETED); 1371 req->status & ZFCP_STATUS_FSFREQ_COMPLETED);
@@ -1462,7 +1463,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
1462 struct zfcp_fsf_req *req; 1463 struct zfcp_fsf_req *req;
1463 int retval = -EIO; 1464 int retval = -EIO;
1464 1465
1465 spin_lock_bh(&adapter->req_q.lock); 1466 spin_lock_bh(&adapter->req_q_lock);
1466 if (zfcp_fsf_req_sbal_get(adapter)) 1467 if (zfcp_fsf_req_sbal_get(adapter))
1467 goto out; 1468 goto out;
1468 1469
@@ -1492,7 +1493,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
1492 erp_action->fsf_req = NULL; 1493 erp_action->fsf_req = NULL;
1493 } 1494 }
1494out: 1495out:
1495 spin_unlock_bh(&adapter->req_q.lock); 1496 spin_unlock_bh(&adapter->req_q_lock);
1496 return retval; 1497 return retval;
1497} 1498}
1498 1499
@@ -1530,7 +1531,7 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
1530 struct zfcp_fsf_req *req; 1531 struct zfcp_fsf_req *req;
1531 int retval = -EIO; 1532 int retval = -EIO;
1532 1533
1533 spin_lock_bh(&adapter->req_q.lock); 1534 spin_lock_bh(&adapter->req_q_lock);
1534 if (zfcp_fsf_req_sbal_get(adapter)) 1535 if (zfcp_fsf_req_sbal_get(adapter))
1535 goto out; 1536 goto out;
1536 1537
@@ -1559,7 +1560,7 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
1559 erp_action->fsf_req = NULL; 1560 erp_action->fsf_req = NULL;
1560 } 1561 }
1561out: 1562out:
1562 spin_unlock_bh(&adapter->req_q.lock); 1563 spin_unlock_bh(&adapter->req_q_lock);
1563 return retval; 1564 return retval;
1564} 1565}
1565 1566
@@ -1603,7 +1604,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_wka_port *wka_port)
1603 struct zfcp_fsf_req *req; 1604 struct zfcp_fsf_req *req;
1604 int retval = -EIO; 1605 int retval = -EIO;
1605 1606
1606 spin_lock_bh(&adapter->req_q.lock); 1607 spin_lock_bh(&adapter->req_q_lock);
1607 if (zfcp_fsf_req_sbal_get(adapter)) 1608 if (zfcp_fsf_req_sbal_get(adapter))
1608 goto out; 1609 goto out;
1609 1610
@@ -1629,7 +1630,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_wka_port *wka_port)
1629 if (retval) 1630 if (retval)
1630 zfcp_fsf_req_free(req); 1631 zfcp_fsf_req_free(req);
1631out: 1632out:
1632 spin_unlock_bh(&adapter->req_q.lock); 1633 spin_unlock_bh(&adapter->req_q_lock);
1633 return retval; 1634 return retval;
1634} 1635}
1635 1636
@@ -1658,7 +1659,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_wka_port *wka_port)
1658 struct zfcp_fsf_req *req; 1659 struct zfcp_fsf_req *req;
1659 int retval = -EIO; 1660 int retval = -EIO;
1660 1661
1661 spin_lock_bh(&adapter->req_q.lock); 1662 spin_lock_bh(&adapter->req_q_lock);
1662 if (zfcp_fsf_req_sbal_get(adapter)) 1663 if (zfcp_fsf_req_sbal_get(adapter))
1663 goto out; 1664 goto out;
1664 1665
@@ -1683,7 +1684,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_wka_port *wka_port)
1683 if (retval) 1684 if (retval)
1684 zfcp_fsf_req_free(req); 1685 zfcp_fsf_req_free(req);
1685out: 1686out:
1686 spin_unlock_bh(&adapter->req_q.lock); 1687 spin_unlock_bh(&adapter->req_q_lock);
1687 return retval; 1688 return retval;
1688} 1689}
1689 1690
@@ -1750,7 +1751,7 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
1750 struct zfcp_fsf_req *req; 1751 struct zfcp_fsf_req *req;
1751 int retval = -EIO; 1752 int retval = -EIO;
1752 1753
1753 spin_lock_bh(&adapter->req_q.lock); 1754 spin_lock_bh(&adapter->req_q_lock);
1754 if (zfcp_fsf_req_sbal_get(adapter)) 1755 if (zfcp_fsf_req_sbal_get(adapter))
1755 goto out; 1756 goto out;
1756 1757
@@ -1781,7 +1782,7 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
1781 erp_action->fsf_req = NULL; 1782 erp_action->fsf_req = NULL;
1782 } 1783 }
1783out: 1784out:
1784 spin_unlock_bh(&adapter->req_q.lock); 1785 spin_unlock_bh(&adapter->req_q_lock);
1785 return retval; 1786 return retval;
1786} 1787}
1787 1788
@@ -1924,7 +1925,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
1924 struct zfcp_fsf_req *req; 1925 struct zfcp_fsf_req *req;
1925 int retval = -EIO; 1926 int retval = -EIO;
1926 1927
1927 spin_lock_bh(&adapter->req_q.lock); 1928 spin_lock_bh(&adapter->req_q_lock);
1928 if (zfcp_fsf_req_sbal_get(adapter)) 1929 if (zfcp_fsf_req_sbal_get(adapter))
1929 goto out; 1930 goto out;
1930 1931
@@ -1957,7 +1958,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
1957 erp_action->fsf_req = NULL; 1958 erp_action->fsf_req = NULL;
1958 } 1959 }
1959out: 1960out:
1960 spin_unlock_bh(&adapter->req_q.lock); 1961 spin_unlock_bh(&adapter->req_q_lock);
1961 return retval; 1962 return retval;
1962} 1963}
1963 1964
@@ -2010,7 +2011,7 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action)
2010 struct zfcp_fsf_req *req; 2011 struct zfcp_fsf_req *req;
2011 int retval = -EIO; 2012 int retval = -EIO;
2012 2013
2013 spin_lock_bh(&adapter->req_q.lock); 2014 spin_lock_bh(&adapter->req_q_lock);
2014 if (zfcp_fsf_req_sbal_get(adapter)) 2015 if (zfcp_fsf_req_sbal_get(adapter))
2015 goto out; 2016 goto out;
2016 req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_LUN, 2017 req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_LUN,
@@ -2039,7 +2040,7 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action)
2039 erp_action->fsf_req = NULL; 2040 erp_action->fsf_req = NULL;
2040 } 2041 }
2041out: 2042out:
2042 spin_unlock_bh(&adapter->req_q.lock); 2043 spin_unlock_bh(&adapter->req_q_lock);
2043 return retval; 2044 return retval;
2044} 2045}
2045 2046
@@ -2281,7 +2282,7 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter,
2281 ZFCP_STATUS_COMMON_UNBLOCKED))) 2282 ZFCP_STATUS_COMMON_UNBLOCKED)))
2282 return -EBUSY; 2283 return -EBUSY;
2283 2284
2284 spin_lock(&adapter->req_q.lock); 2285 spin_lock(&adapter->req_q_lock);
2285 if (!zfcp_fsf_sbal_available(adapter)) 2286 if (!zfcp_fsf_sbal_available(adapter))
2286 goto out; 2287 goto out;
2287 req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags, 2288 req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags,
@@ -2380,7 +2381,7 @@ failed_scsi_cmnd:
2380 zfcp_fsf_req_free(req); 2381 zfcp_fsf_req_free(req);
2381 scsi_cmnd->host_scribble = NULL; 2382 scsi_cmnd->host_scribble = NULL;
2382out: 2383out:
2383 spin_unlock(&adapter->req_q.lock); 2384 spin_unlock(&adapter->req_q_lock);
2384 return retval; 2385 return retval;
2385} 2386}
2386 2387
@@ -2404,7 +2405,7 @@ struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_adapter *adapter,
2404 ZFCP_STATUS_COMMON_UNBLOCKED))) 2405 ZFCP_STATUS_COMMON_UNBLOCKED)))
2405 return NULL; 2406 return NULL;
2406 2407
2407 spin_lock(&adapter->req_q.lock); 2408 spin_lock(&adapter->req_q_lock);
2408 if (!zfcp_fsf_sbal_available(adapter)) 2409 if (!zfcp_fsf_sbal_available(adapter))
2409 goto out; 2410 goto out;
2410 req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags, 2411 req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags,
@@ -2437,7 +2438,7 @@ struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_adapter *adapter,
2437 zfcp_fsf_req_free(req); 2438 zfcp_fsf_req_free(req);
2438 req = NULL; 2439 req = NULL;
2439out: 2440out:
2440 spin_unlock(&adapter->req_q.lock); 2441 spin_unlock(&adapter->req_q_lock);
2441 return req; 2442 return req;
2442} 2443}
2443 2444
@@ -2475,7 +2476,7 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter,
2475 return ERR_PTR(-EINVAL); 2476 return ERR_PTR(-EINVAL);
2476 } 2477 }
2477 2478
2478 spin_lock_bh(&adapter->req_q.lock); 2479 spin_lock_bh(&adapter->req_q_lock);
2479 if (zfcp_fsf_req_sbal_get(adapter)) 2480 if (zfcp_fsf_req_sbal_get(adapter))
2480 goto out; 2481 goto out;
2481 2482
@@ -2505,7 +2506,7 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter,
2505 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); 2506 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
2506 retval = zfcp_fsf_req_send(req); 2507 retval = zfcp_fsf_req_send(req);
2507out: 2508out:
2508 spin_unlock_bh(&adapter->req_q.lock); 2509 spin_unlock_bh(&adapter->req_q_lock);
2509 2510
2510 if (!retval) { 2511 if (!retval) {
2511 wait_event(req->completion_wq, 2512 wait_event(req->completion_wq,
diff --git a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c
index 0dfaa176af7f..3e05080e62d4 100644
--- a/drivers/s390/scsi/zfcp_qdio.c
+++ b/drivers/s390/scsi/zfcp_qdio.c
@@ -346,7 +346,7 @@ int zfcp_qdio_send(struct zfcp_fsf_req *fsf_req)
346 struct qdio_buffer_element *sbale; 346 struct qdio_buffer_element *sbale;
347 347
348 /* acknowledgements for transferred buffers */ 348 /* acknowledgements for transferred buffers */
349 pci_batch = req_q->pci_batch + count; 349 pci_batch = adapter->req_q_pci_batch + count;
350 if (unlikely(pci_batch >= ZFCP_QDIO_PCI_INTERVAL)) { 350 if (unlikely(pci_batch >= ZFCP_QDIO_PCI_INTERVAL)) {
351 pci_batch %= ZFCP_QDIO_PCI_INTERVAL; 351 pci_batch %= ZFCP_QDIO_PCI_INTERVAL;
352 pci = first + count - (pci_batch + 1); 352 pci = first + count - (pci_batch + 1);
@@ -366,7 +366,7 @@ int zfcp_qdio_send(struct zfcp_fsf_req *fsf_req)
366 atomic_sub(count, &req_q->count); 366 atomic_sub(count, &req_q->count);
367 req_q->first += count; 367 req_q->first += count;
368 req_q->first %= QDIO_MAX_BUFFERS_PER_Q; 368 req_q->first %= QDIO_MAX_BUFFERS_PER_Q;
369 req_q->pci_batch = pci_batch; 369 adapter->req_q_pci_batch = pci_batch;
370 return 0; 370 return 0;
371} 371}
372 372
@@ -422,9 +422,9 @@ void zfcp_qdio_close(struct zfcp_adapter *adapter)
422 422
423 /* clear QDIOUP flag, thus do_QDIO is not called during qdio_shutdown */ 423 /* clear QDIOUP flag, thus do_QDIO is not called during qdio_shutdown */
424 req_q = &adapter->req_q; 424 req_q = &adapter->req_q;
425 spin_lock_bh(&req_q->lock); 425 spin_lock_bh(&adapter->req_q_lock);
426 atomic_clear_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status); 426 atomic_clear_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status);
427 spin_unlock_bh(&req_q->lock); 427 spin_unlock_bh(&adapter->req_q_lock);
428 428
429 qdio_shutdown(adapter->ccw_device, QDIO_FLAG_CLEANUP_USING_CLEAR); 429 qdio_shutdown(adapter->ccw_device, QDIO_FLAG_CLEANUP_USING_CLEAR);
430 430
@@ -437,7 +437,7 @@ void zfcp_qdio_close(struct zfcp_adapter *adapter)
437 } 437 }
438 req_q->first = 0; 438 req_q->first = 0;
439 atomic_set(&req_q->count, 0); 439 atomic_set(&req_q->count, 0);
440 req_q->pci_batch = 0; 440 adapter->req_q_pci_batch = 0;
441 adapter->resp_q.first = 0; 441 adapter->resp_q.first = 0;
442 atomic_set(&adapter->resp_q.count, 0); 442 atomic_set(&adapter->resp_q.count, 0);
443} 443}
@@ -475,7 +475,7 @@ int zfcp_qdio_open(struct zfcp_adapter *adapter)
475 /* set index of first avalable SBALS / number of available SBALS */ 475 /* set index of first avalable SBALS / number of available SBALS */
476 adapter->req_q.first = 0; 476 adapter->req_q.first = 0;
477 atomic_set(&adapter->req_q.count, QDIO_MAX_BUFFERS_PER_Q); 477 atomic_set(&adapter->req_q.count, QDIO_MAX_BUFFERS_PER_Q);
478 adapter->req_q.pci_batch = 0; 478 adapter->req_q_pci_batch = 0;
479 479
480 return 0; 480 return 0;
481 481
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index cf6a14793371..ca8f85f3dad4 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -105,13 +105,17 @@ static struct zfcp_unit *zfcp_unit_lookup(struct zfcp_adapter *adapter,
105{ 105{
106 struct zfcp_port *port; 106 struct zfcp_port *port;
107 struct zfcp_unit *unit; 107 struct zfcp_unit *unit;
108 int scsi_lun;
108 109
109 list_for_each_entry(port, &adapter->port_list_head, list) { 110 list_for_each_entry(port, &adapter->port_list_head, list) {
110 if (!port->rport || (id != port->rport->scsi_target_id)) 111 if (!port->rport || (id != port->rport->scsi_target_id))
111 continue; 112 continue;
112 list_for_each_entry(unit, &port->unit_list_head, list) 113 list_for_each_entry(unit, &port->unit_list_head, list) {
113 if (lun == unit->scsi_lun) 114 scsi_lun = scsilun_to_int(
115 (struct scsi_lun *)&unit->fcp_lun);
116 if (lun == scsi_lun)
114 return unit; 117 return unit;
118 }
115 } 119 }
116 120
117 return NULL; 121 return NULL;
diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c
index 7f7384c02a53..2809d789b55c 100644
--- a/drivers/s390/scsi/zfcp_sysfs.c
+++ b/drivers/s390/scsi/zfcp_sysfs.c
@@ -137,6 +137,7 @@ static ssize_t zfcp_sysfs_port_remove_store(struct device *dev,
137 struct zfcp_port *port; 137 struct zfcp_port *port;
138 u64 wwpn; 138 u64 wwpn;
139 int retval = 0; 139 int retval = 0;
140 LIST_HEAD(port_remove_lh);
140 141
141 down(&zfcp_data.config_sema); 142 down(&zfcp_data.config_sema);
142 if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_REMOVE) { 143 if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_REMOVE) {
@@ -154,7 +155,7 @@ static ssize_t zfcp_sysfs_port_remove_store(struct device *dev,
154 if (port && (atomic_read(&port->refcount) == 0)) { 155 if (port && (atomic_read(&port->refcount) == 0)) {
155 zfcp_port_get(port); 156 zfcp_port_get(port);
156 atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status); 157 atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status);
157 list_move(&port->list, &adapter->port_remove_lh); 158 list_move(&port->list, &port_remove_lh);
158 } else 159 } else
159 port = NULL; 160 port = NULL;
160 write_unlock_irq(&zfcp_data.config_lock); 161 write_unlock_irq(&zfcp_data.config_lock);
@@ -235,6 +236,7 @@ static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev,
235 struct zfcp_unit *unit; 236 struct zfcp_unit *unit;
236 u64 fcp_lun; 237 u64 fcp_lun;
237 int retval = 0; 238 int retval = 0;
239 LIST_HEAD(unit_remove_lh);
238 240
239 down(&zfcp_data.config_sema); 241 down(&zfcp_data.config_sema);
240 if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_REMOVE) { 242 if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_REMOVE) {
@@ -252,7 +254,7 @@ static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev,
252 if (unit && (atomic_read(&unit->refcount) == 0)) { 254 if (unit && (atomic_read(&unit->refcount) == 0)) {
253 zfcp_unit_get(unit); 255 zfcp_unit_get(unit);
254 atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status); 256 atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status);
255 list_move(&unit->list, &port->unit_remove_lh); 257 list_move(&unit->list, &unit_remove_lh);
256 } else 258 } else
257 unit = NULL; 259 unit = NULL;
258 260