Revert "scsi: core: avoid host-wide host_busy counter for scsi_mq"

This reverts commit 328728630d.

There is fundamental issue in commit 328728630d (scsi: core: avoid
host-wide host_busy counter for scsi_mq) because SCSI's host busy counter
may not be same with counter of blk-mq's inflight tags, especially in case
of none io scheduler.

We may switch to other approach for addressing this scsi_mq's performance
issue, such as percpu counter or kind of ways, so revert this commit first
for fixing this kind of issue in EH path, as reported by Jens.

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>
Cc: Jens Axboe <axboe@kernel.dk>
Reported-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Ming Lei
2018-08-27 15:24:43 +08:00
committed by Martin K. Petersen
parent 23aa8e69f2
commit d772a65d8a
2 changed files with 7 additions and 40 deletions

View File

@@ -563,35 +563,13 @@ struct Scsi_Host *scsi_host_get(struct Scsi_Host *shost)
}
EXPORT_SYMBOL(scsi_host_get);
struct scsi_host_mq_in_flight {
int cnt;
};
static void scsi_host_check_in_flight(struct request *rq, void *data,
bool reserved)
{
struct scsi_host_mq_in_flight *in_flight = data;
if (blk_mq_request_started(rq))
in_flight->cnt++;
}
/**
* scsi_host_busy - Return the host busy counter
* @shost: Pointer to Scsi_Host to inc.
**/
int scsi_host_busy(struct Scsi_Host *shost)
{
struct scsi_host_mq_in_flight in_flight = {
.cnt = 0,
};
if (!shost->use_blk_mq)
return atomic_read(&shost->host_busy);
blk_mq_tagset_busy_iter(&shost->tag_set, scsi_host_check_in_flight,
&in_flight);
return in_flight.cnt;
return atomic_read(&shost->host_busy);
}
EXPORT_SYMBOL(scsi_host_busy);