diff options
author | Christoph Hellwig <hch@lst.de> | 2014-01-22 09:29:29 -0500 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-07-25 07:43:43 -0400 |
commit | 74665016086615bbaa3fa6f83af410a0a4e029ee (patch) | |
tree | 9f9d8a692bec91dce69fd303eeedf16c35b41ac6 /drivers/scsi/libiscsi.c | |
parent | 7ae65c0f9646c29432b69580b80e08632e6cd813 (diff) |
scsi: convert host_busy to atomic_t
Avoid taking the host-wide host_lock to check the per-host queue limit.
Instead we do an atomic_inc_return early on to grab our slot in the queue,
and if necessary decrement it after finishing all checks.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Webb Scales <webbnh@hp.com>
Acked-by: Jens Axboe <axboe@kernel.dk>
Tested-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Robert Elliott <elliott@hp.com>
Diffstat (limited to 'drivers/scsi/libiscsi.c')
-rw-r--r-- | drivers/scsi/libiscsi.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index f2db82beb646..f9f3a1224dfa 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -2971,7 +2971,7 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn) | |||
2971 | */ | 2971 | */ |
2972 | for (;;) { | 2972 | for (;;) { |
2973 | spin_lock_irqsave(session->host->host_lock, flags); | 2973 | spin_lock_irqsave(session->host->host_lock, flags); |
2974 | if (!session->host->host_busy) { /* OK for ERL == 0 */ | 2974 | if (!atomic_read(&session->host->host_busy)) { /* OK for ERL == 0 */ |
2975 | spin_unlock_irqrestore(session->host->host_lock, flags); | 2975 | spin_unlock_irqrestore(session->host->host_lock, flags); |
2976 | break; | 2976 | break; |
2977 | } | 2977 | } |
@@ -2979,7 +2979,7 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn) | |||
2979 | msleep_interruptible(500); | 2979 | msleep_interruptible(500); |
2980 | iscsi_conn_printk(KERN_INFO, conn, "iscsi conn_destroy(): " | 2980 | iscsi_conn_printk(KERN_INFO, conn, "iscsi conn_destroy(): " |
2981 | "host_busy %d host_failed %d\n", | 2981 | "host_busy %d host_failed %d\n", |
2982 | session->host->host_busy, | 2982 | atomic_read(&session->host->host_busy), |
2983 | session->host->host_failed); | 2983 | session->host->host_failed); |
2984 | /* | 2984 | /* |
2985 | * force eh_abort() to unblock | 2985 | * force eh_abort() to unblock |