Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: read host_busy via scsi_host_busy()

No functional change.

Just introduce scsi_host_busy() and replace the direct read of
scsi_host->host_busy with this new API.

Cc: Omar Sandoval <osandov@fb.com>,
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
Cc: James Bottomley <james.bottomley@hansenpartnership.com>,
Cc: Christoph Hellwig <hch@lst.de>,
Cc: Don Brace <don.brace@microsemi.com>
Cc: Kashyap Desai <kashyap.desai@broadcom.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Laurence Oberman <loberman@redhat.com>
Cc: Bart Van Assche <bart.vanassche@wdc.com>

Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Ming Lei and committed by
Martin K. Petersen
c84b023a 2b33ab37

+26 -15
+4 -4
drivers/scsi/advansys.c
··· 2416 2416 struct asc_board *boardp = shost_priv(s); 2417 2417 2418 2418 printk("Scsi_Host at addr 0x%p, device %s\n", s, dev_name(boardp->dev)); 2419 - printk(" host_busy %u, host_no %d,\n", 2420 - atomic_read(&s->host_busy), s->host_no); 2419 + printk(" host_busy %d, host_no %d,\n", 2420 + scsi_host_busy(s), s->host_no); 2421 2421 2422 2422 printk(" base 0x%lx, io_port 0x%lx, irq %d,\n", 2423 2423 (ulong)s->base, (ulong)s->io_port, boardp->irq); ··· 3182 3182 shost->host_no); 3183 3183 3184 3184 seq_printf(m, 3185 - " host_busy %u, max_id %u, max_lun %llu, max_channel %u\n", 3186 - atomic_read(&shost->host_busy), shost->max_id, 3185 + " host_busy %d, max_id %u, max_lun %llu, max_channel %u\n", 3186 + scsi_host_busy(shost), shost->max_id, 3187 3187 shost->max_lun, shost->max_channel); 3188 3188 3189 3189 seq_printf(m,
+10
drivers/scsi/hosts.c
··· 564 564 EXPORT_SYMBOL(scsi_host_get); 565 565 566 566 /** 567 + * scsi_host_busy - Return the host busy counter 568 + * @shost: Pointer to Scsi_Host to inc. 569 + **/ 570 + int scsi_host_busy(struct Scsi_Host *shost) 571 + { 572 + return atomic_read(&shost->host_busy); 573 + } 574 + EXPORT_SYMBOL(scsi_host_busy); 575 + 576 + /** 567 577 * scsi_host_put - dec a Scsi_Host ref count 568 578 * @shost: Pointer to Scsi_Host to dec. 569 579 **/
+2 -2
drivers/scsi/libsas/sas_scsi_host.c
··· 759 759 spin_unlock_irq(shost->host_lock); 760 760 761 761 SAS_DPRINTK("Enter %s busy: %d failed: %d\n", 762 - __func__, atomic_read(&shost->host_busy), shost->host_failed); 762 + __func__, scsi_host_busy(shost), shost->host_failed); 763 763 /* 764 764 * Deal with commands that still have SAS tasks (i.e. they didn't 765 765 * complete via the normal sas_task completion mechanism), ··· 801 801 goto retry; 802 802 803 803 SAS_DPRINTK("--- Exit %s: busy: %d failed: %d tries: %d\n", 804 - __func__, atomic_read(&shost->host_busy), 804 + __func__, scsi_host_busy(shost), 805 805 shost->host_failed, tries); 806 806 } 807 807
+1 -1
drivers/scsi/megaraid/megaraid_sas_base.c
··· 2834 2834 "SCSI command pointer: (%p)\t SCSI host state: %d\t" 2835 2835 " SCSI host busy: %d\t FW outstanding: %d\n", 2836 2836 scmd, scmd->device->host->shost_state, 2837 - atomic_read((atomic_t *)&scmd->device->host->host_busy), 2837 + scsi_host_busy(scmd->device->host), 2838 2838 atomic_read(&instance->fw_outstanding)); 2839 2839 2840 2840 /*
+2 -2
drivers/scsi/mpt3sas/mpt3sas_base.c
··· 3250 3250 * See _wait_for_commands_to_complete() call with regards to this code. 3251 3251 */ 3252 3252 if (ioc->shost_recovery && ioc->pending_io_count) { 3253 - ioc->pending_io_count = atomic_read(&ioc->shost->host_busy); 3253 + ioc->pending_io_count = scsi_host_busy(ioc->shost); 3254 3254 if (ioc->pending_io_count == 0) 3255 3255 wake_up(&ioc->reset_wq); 3256 3256 } ··· 6857 6857 return; 6858 6858 6859 6859 /* pending command count */ 6860 - ioc->pending_io_count = atomic_read(&ioc->shost->host_busy); 6860 + ioc->pending_io_count = scsi_host_busy(ioc->shost); 6861 6861 6862 6862 if (!ioc->pending_io_count) 6863 6863 return;
+1 -1
drivers/scsi/qlogicpti.c
··· 959 959 /* Temporary workaround until bug is found and fixed (one bug has been found 960 960 already, but fixing it makes things even worse) -jj */ 961 961 int num_free = QLOGICPTI_REQ_QUEUE_LEN - REQ_QUEUE_DEPTH(in_ptr, out_ptr) - 64; 962 - host->can_queue = atomic_read(&host->host_busy) + num_free; 962 + host->can_queue = scsi_host_busy(host) + num_free; 963 963 host->sg_tablesize = QLOGICPTI_MAX_SG(num_free); 964 964 } 965 965
+1 -1
drivers/scsi/scsi.c
··· 167 167 if (level > 3) 168 168 scmd_printk(KERN_INFO, cmd, 169 169 "scsi host busy %d failed %d\n", 170 - atomic_read(&cmd->device->host->host_busy), 170 + scsi_host_busy(cmd->device->host), 171 171 cmd->device->host->host_failed); 172 172 } 173 173 }
+3 -3
drivers/scsi/scsi_error.c
··· 66 66 { 67 67 lockdep_assert_held(shost->host_lock); 68 68 69 - if (atomic_read(&shost->host_busy) == shost->host_failed) { 69 + if (scsi_host_busy(shost) == shost->host_failed) { 70 70 trace_scsi_eh_wakeup(shost); 71 71 wake_up_process(shost->ehandler); 72 72 SCSI_LOG_ERROR_RECOVERY(5, shost_printk(KERN_INFO, shost, ··· 2155 2155 break; 2156 2156 2157 2157 if ((shost->host_failed == 0 && shost->host_eh_scheduled == 0) || 2158 - shost->host_failed != atomic_read(&shost->host_busy)) { 2158 + shost->host_failed != scsi_host_busy(shost)) { 2159 2159 SCSI_LOG_ERROR_RECOVERY(1, 2160 2160 shost_printk(KERN_INFO, shost, 2161 2161 "scsi_eh_%d: sleeping\n", ··· 2170 2170 "scsi_eh_%d: waking up %d/%d/%d\n", 2171 2171 shost->host_no, shost->host_eh_scheduled, 2172 2172 shost->host_failed, 2173 - atomic_read(&shost->host_busy))); 2173 + scsi_host_busy(shost))); 2174 2174 2175 2175 /* 2176 2176 * We have a host that is failing for some reason. Figure out
+1 -1
drivers/scsi/scsi_sysfs.c
··· 382 382 show_host_busy(struct device *dev, struct device_attribute *attr, char *buf) 383 383 { 384 384 struct Scsi_Host *shost = class_to_shost(dev); 385 - return snprintf(buf, 20, "%d\n", atomic_read(&shost->host_busy)); 385 + return snprintf(buf, 20, "%d\n", scsi_host_busy(shost)); 386 386 } 387 387 static DEVICE_ATTR(host_busy, S_IRUGO, show_host_busy, NULL); 388 388
+1
include/scsi/scsi_host.h
··· 758 758 extern void scsi_rescan_device(struct device *); 759 759 extern void scsi_remove_host(struct Scsi_Host *); 760 760 extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *); 761 + extern int scsi_host_busy(struct Scsi_Host *shost); 761 762 extern void scsi_host_put(struct Scsi_Host *t); 762 763 extern struct Scsi_Host *scsi_host_lookup(unsigned short); 763 764 extern const char *scsi_host_state_name(enum scsi_host_state);