scsi: convert device_busy to atomic_t
authorChristoph Hellwig <[email protected]>
Fri, 11 Apr 2014 17:07:01 +0000 (19:07 +0200)
committerChristoph Hellwig <[email protected]>
Fri, 25 Jul 2014 11:43:45 +0000 (07:43 -0400)
commit71e75c97f97a9645d25fbf3d8e4165a558f18747
treefb85185386af55199c46499dc3ce366d227870e1
parent74665016086615bbaa3fa6f83af410a0a4e029ee
scsi: convert device_busy to atomic_t

Avoid taking the queue_lock to check the per-device 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.

Unlike the host and target busy counters this doesn't allow us to avoid the
queue_lock in the request_fn due to the way the interface works, but it'll
allow us to prepare for using the blk-mq code, which doesn't use the
queue_lock at all, and it at least avoids a queue_lock round trip in
scsi_device_unbusy, which is still important given how busy the queue_lock
is.

Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Hannes Reinecke <[email protected]>
Reviewed-by: Webb Scales <[email protected]>
Acked-by: Jens Axboe <[email protected]>
Tested-by: Bart Van Assche <[email protected]>
Tested-by: Robert Elliott <[email protected]>
drivers/message/fusion/mptsas.c
drivers/scsi/scsi_lib.c
drivers/scsi/scsi_sysfs.c
drivers/scsi/sg.c
include/scsi/scsi_device.h