aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2008-12-19 10:56:54 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-12-29 12:24:36 -0500
commitdedbc2b3cb8404c618975bd2811c7605a4ccb51e (patch)
tree0b97af05604e62e1110fe6ba1cab5ee08374b8e4 /drivers/s390/scsi
parent1d3aab084a2b4d6c60c8478b3ddf5dd9391f6a32 (diff)
[SCSI] zfcp: Simplify SBAL allocation to fix sparse warnings
When waiting for a request claim the SBAL before waiting. This way, locking before each check of the free counter is not required and sparse does not emit warnings for the complicated locking scheme. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Acked-by: Felix Beck <felix@linux.vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/s390/scsi')
-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