scsi: convert device_busy to atomic_t
authorChristoph Hellwig <hch@lst.de>
Thu, 26 Jun 2014 02:13:31 +0000 (20:13 -0600)
committerJens Axboe <axboe@fb.com>
Thu, 2 Apr 2015 18:12:27 +0000 (12:12 -0600)
commit7edbc26c12b94b2a70699ace8638bdc36a6b908c
tree682c33ef8d20a5eb8cac3ad9dd36ca77dfbcf216
parentb92b25441f106b000a60e1e68f533689024bd95c
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 nessecary 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 rountrip in
scsi_device_unbusy, which is still important given how busy the queue_lock
is.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/message/fusion/mptsas.c
drivers/scsi/scsi_lib.c
drivers/scsi/scsi_sysfs.c
drivers/scsi/sg.c
include/scsi/scsi_device.h