Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c84b023a authored by Ming Lei's avatar Ming Lei Committed by Martin K. Petersen
Browse files

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: default avatarMing Lei <ming.lei@redhat.com>
Reviewed-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 2b33ab37
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -2416,8 +2416,8 @@ static void asc_prt_scsi_host(struct Scsi_Host *s)
	struct asc_board *boardp = shost_priv(s);

	printk("Scsi_Host at addr 0x%p, device %s\n", s, dev_name(boardp->dev));
	printk(" host_busy %u, host_no %d,\n",
	       atomic_read(&s->host_busy), s->host_no);
	printk(" host_busy %d, host_no %d,\n",
	       scsi_host_busy(s), s->host_no);

	printk(" base 0x%lx, io_port 0x%lx, irq %d,\n",
	       (ulong)s->base, (ulong)s->io_port, boardp->irq);
@@ -3182,8 +3182,8 @@ static void asc_prt_driver_conf(struct seq_file *m, struct Scsi_Host *shost)
		shost->host_no);

	seq_printf(m,
		   " host_busy %u, max_id %u, max_lun %llu, max_channel %u\n",
		   atomic_read(&shost->host_busy), shost->max_id,
		   " host_busy %d, max_id %u, max_lun %llu, max_channel %u\n",
		   scsi_host_busy(shost), shost->max_id,
		   shost->max_lun, shost->max_channel);

	seq_printf(m,
+10 −0
Original line number Diff line number Diff line
@@ -563,6 +563,16 @@ struct Scsi_Host *scsi_host_get(struct Scsi_Host *shost)
}
EXPORT_SYMBOL(scsi_host_get);

/**
 * scsi_host_busy - Return the host busy counter
 * @shost:	Pointer to Scsi_Host to inc.
 **/
int scsi_host_busy(struct Scsi_Host *shost)
{
	return atomic_read(&shost->host_busy);
}
EXPORT_SYMBOL(scsi_host_busy);

/**
 * scsi_host_put - dec a Scsi_Host ref count
 * @shost:	Pointer to Scsi_Host to dec.
+2 −2
Original line number Diff line number Diff line
@@ -759,7 +759,7 @@ void sas_scsi_recover_host(struct Scsi_Host *shost)
	spin_unlock_irq(shost->host_lock);

	SAS_DPRINTK("Enter %s busy: %d failed: %d\n",
		    __func__, atomic_read(&shost->host_busy), shost->host_failed);
		    __func__, scsi_host_busy(shost), shost->host_failed);
	/*
	 * Deal with commands that still have SAS tasks (i.e. they didn't
	 * complete via the normal sas_task completion mechanism),
@@ -801,7 +801,7 @@ void sas_scsi_recover_host(struct Scsi_Host *shost)
		goto retry;

	SAS_DPRINTK("--- Exit %s: busy: %d failed: %d tries: %d\n",
		    __func__, atomic_read(&shost->host_busy),
		    __func__, scsi_host_busy(shost),
		    shost->host_failed, tries);
}

+1 −1
Original line number Diff line number Diff line
@@ -2834,7 +2834,7 @@ static int megasas_reset_bus_host(struct scsi_cmnd *scmd)
		"SCSI command pointer: (%p)\t SCSI host state: %d\t"
		" SCSI host busy: %d\t FW outstanding: %d\n",
		scmd, scmd->device->host->shost_state,
		atomic_read((atomic_t *)&scmd->device->host->host_busy),
		scsi_host_busy(scmd->device->host),
		atomic_read(&instance->fw_outstanding));

	/*
+2 −2
Original line number Diff line number Diff line
@@ -3250,7 +3250,7 @@ _base_recovery_check(struct MPT3SAS_ADAPTER *ioc)
	 * See _wait_for_commands_to_complete() call with regards to this code.
	 */
	if (ioc->shost_recovery && ioc->pending_io_count) {
		ioc->pending_io_count = atomic_read(&ioc->shost->host_busy);
		ioc->pending_io_count = scsi_host_busy(ioc->shost);
		if (ioc->pending_io_count == 0)
			wake_up(&ioc->reset_wq);
	}
@@ -6857,7 +6857,7 @@ mpt3sas_wait_for_commands_to_complete(struct MPT3SAS_ADAPTER *ioc)
		return;

	/* pending command count */
	ioc->pending_io_count = atomic_read(&ioc->shost->host_busy);
	ioc->pending_io_count = scsi_host_busy(ioc->shost);

	if (!ioc->pending_io_count)
		return;
Loading