aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_sysfs.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-01-22 09:29:29 -0500
committerChristoph Hellwig <hch@lst.de>2014-07-25 07:43:43 -0400
commit74665016086615bbaa3fa6f83af410a0a4e029ee (patch)
tree9f9d8a692bec91dce69fd303eeedf16c35b41ac6 /drivers/scsi/scsi_sysfs.c
parent7ae65c0f9646c29432b69580b80e08632e6cd813 (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/scsi_sysfs.c')
-rw-r--r--drivers/scsi/scsi_sysfs.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 5f36788705ba..de57b8bca7be 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -334,7 +334,6 @@ store_shost_eh_deadline(struct device *dev, struct device_attribute *attr,
334static DEVICE_ATTR(eh_deadline, S_IRUGO | S_IWUSR, show_shost_eh_deadline, store_shost_eh_deadline); 334static DEVICE_ATTR(eh_deadline, S_IRUGO | S_IWUSR, show_shost_eh_deadline, store_shost_eh_deadline);
335 335
336shost_rd_attr(unique_id, "%u\n"); 336shost_rd_attr(unique_id, "%u\n");
337shost_rd_attr(host_busy, "%hu\n");
338shost_rd_attr(cmd_per_lun, "%hd\n"); 337shost_rd_attr(cmd_per_lun, "%hd\n");
339shost_rd_attr(can_queue, "%hd\n"); 338shost_rd_attr(can_queue, "%hd\n");
340shost_rd_attr(sg_tablesize, "%hu\n"); 339shost_rd_attr(sg_tablesize, "%hu\n");
@@ -344,6 +343,14 @@ shost_rd_attr(prot_capabilities, "%u\n");
344shost_rd_attr(prot_guard_type, "%hd\n"); 343shost_rd_attr(prot_guard_type, "%hd\n");
345shost_rd_attr2(proc_name, hostt->proc_name, "%s\n"); 344shost_rd_attr2(proc_name, hostt->proc_name, "%s\n");
346 345
346static ssize_t
347show_host_busy(struct device *dev, struct device_attribute *attr, char *buf)
348{
349 struct Scsi_Host *shost = class_to_shost(dev);
350 return snprintf(buf, 20, "%d\n", atomic_read(&shost->host_busy));
351}
352static DEVICE_ATTR(host_busy, S_IRUGO, show_host_busy, NULL);
353
347static struct attribute *scsi_sysfs_shost_attrs[] = { 354static struct attribute *scsi_sysfs_shost_attrs[] = {
348 &dev_attr_unique_id.attr, 355 &dev_attr_unique_id.attr,
349 &dev_attr_host_busy.attr, 356 &dev_attr_host_busy.attr,