aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 3376305609f9..878b8f86ddc7 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -644,38 +644,38 @@ static void zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *req)
644 } 644 }
645} 645}
646 646
647static int zfcp_fsf_sbal_check(struct zfcp_adapter *adapter) 647static int zfcp_fsf_sbal_available(struct zfcp_adapter *adapter)
648{ 648{
649 struct zfcp_qdio_queue *req_q = &adapter->req_q; 649 if (atomic_read(&adapter->req_q.count) > 0)
650
651 spin_lock_bh(&adapter->req_q_lock);
652 if (atomic_read(&req_q->count))
653 return 1; 650 return 1;
654 spin_unlock_bh(&adapter->req_q_lock); 651 atomic_inc(&adapter->qdio_outb_full);
655 return 0; 652 return 0;
656} 653}
657 654
658static int zfcp_fsf_sbal_available(struct zfcp_adapter *adapter)
659{
660 unsigned int count = atomic_read(&adapter->req_q.count);
661 if (!count)
662 atomic_inc(&adapter->qdio_outb_full);
663 return count > 0;
664}
665
666static int zfcp_fsf_req_sbal_get(struct zfcp_adapter *adapter) 655static int zfcp_fsf_req_sbal_get(struct zfcp_adapter *adapter)
656 __releases(&adapter->req_q_lock)
657 __acquires(&adapter->req_q_lock)
667{ 658{
659 struct zfcp_qdio_queue *req_q = &adapter->req_q;
668 long ret; 660 long ret;
669 661
662 if (atomic_read(&req_q->count) <= -REQUEST_LIST_SIZE)
663 return -EIO;
664 if (atomic_read(&req_q->count) > 0)
665 return 0;
666
667 atomic_dec(&req_q->count);
670 spin_unlock_bh(&adapter->req_q_lock); 668 spin_unlock_bh(&adapter->req_q_lock);
671 ret = wait_event_interruptible_timeout(adapter->request_wq, 669 ret = wait_event_interruptible_timeout(adapter->request_wq,
672 zfcp_fsf_sbal_check(adapter), 5 * HZ); 670 atomic_read(&req_q->count) >= 0,
671 5 * HZ);
672 spin_lock_bh(&adapter->req_q_lock);
673 atomic_inc(&req_q->count);
674
673 if (ret > 0) 675 if (ret > 0)
674 return 0; 676 return 0;
675 if (!ret) 677 if (!ret)
676 atomic_inc(&adapter->qdio_outb_full); 678 atomic_inc(&adapter->qdio_outb_full);
677
678 spin_lock_bh(&adapter->req_q_lock);
679 return -EIO; 679 return -EIO;
680} 680}
681 681