Commit 91921e01 authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Christoph Hellwig

scsi: use dev_printk variants where possible

Using dev_printk variants prefixes the logging message with
the originating device, which makes debugging easier.
Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent e5f73ce3
...@@ -204,12 +204,12 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, ...@@ -204,12 +204,12 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
struct scsi_host_template *sht = shost->hostt; struct scsi_host_template *sht = shost->hostt;
int error = -EINVAL; int error = -EINVAL;
printk(KERN_INFO "scsi%d : %s\n", shost->host_no, shost_printk(KERN_INFO, shost, "%s\n",
sht->info ? sht->info(shost) : sht->name); sht->info ? sht->info(shost) : sht->name);
if (!shost->can_queue) { if (!shost->can_queue) {
printk(KERN_ERR "%s: can_queue = 0 no longer supported\n", shost_printk(KERN_ERR, shost,
sht->name); "can_queue = 0 no longer supported\n");
goto fail; goto fail;
} }
...@@ -450,8 +450,9 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) ...@@ -450,8 +450,9 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
shost->ehandler = kthread_run(scsi_error_handler, shost, shost->ehandler = kthread_run(scsi_error_handler, shost,
"scsi_eh_%d", shost->host_no); "scsi_eh_%d", shost->host_no);
if (IS_ERR(shost->ehandler)) { if (IS_ERR(shost->ehandler)) {
printk(KERN_WARNING "scsi%d: error handler thread failed to spawn, error = %ld\n", shost_printk(KERN_WARNING, shost,
shost->host_no, PTR_ERR(shost->ehandler)); "error handler thread failed to spawn, error = %ld\n",
PTR_ERR(shost->ehandler));
goto fail_kfree; goto fail_kfree;
} }
...@@ -584,7 +585,7 @@ EXPORT_SYMBOL(scsi_is_host_device); ...@@ -584,7 +585,7 @@ EXPORT_SYMBOL(scsi_is_host_device);
int scsi_queue_work(struct Scsi_Host *shost, struct work_struct *work) int scsi_queue_work(struct Scsi_Host *shost, struct work_struct *work)
{ {
if (unlikely(!shost->work_q)) { if (unlikely(!shost->work_q)) {
printk(KERN_ERR shost_printk(KERN_ERR, shost,
"ERROR: Scsi host '%s' attempted to queue scsi-work, " "ERROR: Scsi host '%s' attempted to queue scsi-work, "
"when no workqueue created.\n", shost->hostt->name); "when no workqueue created.\n", shost->hostt->name);
dump_stack(); dump_stack();
...@@ -603,7 +604,7 @@ EXPORT_SYMBOL_GPL(scsi_queue_work); ...@@ -603,7 +604,7 @@ EXPORT_SYMBOL_GPL(scsi_queue_work);
void scsi_flush_work(struct Scsi_Host *shost) void scsi_flush_work(struct Scsi_Host *shost)
{ {
if (!shost->work_q) { if (!shost->work_q) {
printk(KERN_ERR shost_printk(KERN_ERR, shost,
"ERROR: Scsi host '%s' attempted to flush scsi-work, " "ERROR: Scsi host '%s' attempted to flush scsi-work, "
"when no workqueue created.\n", shost->hostt->name); "when no workqueue created.\n", shost->hostt->name);
dump_stack(); dump_stack();
......
...@@ -655,7 +655,7 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) ...@@ -655,7 +655,7 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
/* Check to see if the scsi lld made this device blocked. */ /* Check to see if the scsi lld made this device blocked. */
if (unlikely(scsi_device_blocked(cmd->device))) { if (unlikely(scsi_device_blocked(cmd->device))) {
/* /*
* in blocked state, the command is just put back on * in blocked state, the command is just put back on
* the device queue. The suspend state has already * the device queue. The suspend state has already
* blocked the queue so future requests should not * blocked the queue so future requests should not
...@@ -665,7 +665,8 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) ...@@ -665,7 +665,8 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
scsi_queue_insert(cmd, SCSI_MLQUEUE_DEVICE_BUSY); scsi_queue_insert(cmd, SCSI_MLQUEUE_DEVICE_BUSY);
SCSI_LOG_MLQUEUE(3, printk("queuecommand : device blocked \n")); SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd,
"queuecommand : device blocked\n"));
/* /*
* NOTE: rtn is still zero here because we don't need the * NOTE: rtn is still zero here because we don't need the
...@@ -674,7 +675,7 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) ...@@ -674,7 +675,7 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
goto out; goto out;
} }
/* /*
* If SCSI-2 or lower, store the LUN value in cmnd. * If SCSI-2 or lower, store the LUN value in cmnd.
*/ */
if (cmd->device->scsi_level <= SCSI_2 && if (cmd->device->scsi_level <= SCSI_2 &&
...@@ -690,8 +691,8 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) ...@@ -690,8 +691,8 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
* length exceeds what the host adapter can handle. * length exceeds what the host adapter can handle.
*/ */
if (cmd->cmd_len > cmd->device->host->max_cmd_len) { if (cmd->cmd_len > cmd->device->host->max_cmd_len) {
SCSI_LOG_MLQUEUE(3, SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd,
printk("queuecommand : command too long. " "queuecommand : command too long. "
"cdb_size=%d host->max_cmd_len=%d\n", "cdb_size=%d host->max_cmd_len=%d\n",
cmd->cmd_len, cmd->device->host->max_cmd_len)); cmd->cmd_len, cmd->device->host->max_cmd_len));
cmd->result = (DID_ABORT << 16); cmd->result = (DID_ABORT << 16);
...@@ -715,14 +716,13 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) ...@@ -715,14 +716,13 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
rtn != SCSI_MLQUEUE_TARGET_BUSY) rtn != SCSI_MLQUEUE_TARGET_BUSY)
rtn = SCSI_MLQUEUE_HOST_BUSY; rtn = SCSI_MLQUEUE_HOST_BUSY;
scsi_queue_insert(cmd, rtn); SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd,
"queuecommand : request rejected\n"));
SCSI_LOG_MLQUEUE(3, scsi_queue_insert(cmd, rtn);
printk("queuecommand : request rejected\n"));
} }
out: out:
SCSI_LOG_MLQUEUE(3, printk("leaving scsi_dispatch_cmnd()\n"));
return rtn; return rtn;
} }
......
This diff is collapsed.
...@@ -95,8 +95,8 @@ static void __scsi_queue_insert(struct scsi_cmnd *cmd, int reason, int unbusy) ...@@ -95,8 +95,8 @@ static void __scsi_queue_insert(struct scsi_cmnd *cmd, int reason, int unbusy)
struct request_queue *q = device->request_queue; struct request_queue *q = device->request_queue;
unsigned long flags; unsigned long flags;
SCSI_LOG_MLQUEUE(1, SCSI_LOG_MLQUEUE(1, scmd_printk(KERN_INFO, cmd,
printk("Inserting command %p into mlqueue\n", cmd)); "Inserting command %p into mlqueue\n", cmd));
/* /*
* Set the appropriate busy bit for the device/host. * Set the appropriate busy bit for the device/host.
...@@ -750,9 +750,9 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) ...@@ -750,9 +750,9 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
* Next deal with any sectors which we were able to correctly * Next deal with any sectors which we were able to correctly
* handle. * handle.
*/ */
SCSI_LOG_HLCOMPLETE(1, printk("%u sectors total, " SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, cmd,
"%d bytes done.\n", "%u sectors total, %d bytes done.\n",
blk_rq_sectors(req), good_bytes)); blk_rq_sectors(req), good_bytes));
/* /*
* Recovered errors need reporting, but they're always treated * Recovered errors need reporting, but they're always treated
...@@ -1351,8 +1351,8 @@ static inline int scsi_host_queue_ready(struct request_queue *q, ...@@ -1351,8 +1351,8 @@ static inline int scsi_host_queue_ready(struct request_queue *q,
*/ */
if (--shost->host_blocked == 0) { if (--shost->host_blocked == 0) {
SCSI_LOG_MLQUEUE(3, SCSI_LOG_MLQUEUE(3,
printk("scsi%d unblocking host at zero depth\n", shost_printk(KERN_INFO, shost,
shost->host_no)); "unblocking host at zero depth\n"));
} else { } else {
return 0; return 0;
} }
...@@ -1461,7 +1461,7 @@ static void scsi_softirq_done(struct request *rq) ...@@ -1461,7 +1461,7 @@ static void scsi_softirq_done(struct request *rq)
wait_for/HZ); wait_for/HZ);
disposition = SUCCESS; disposition = SUCCESS;
} }
scsi_log_completion(cmd, disposition); scsi_log_completion(cmd, disposition);
switch (disposition) { switch (disposition) {
...@@ -1509,7 +1509,7 @@ static void scsi_request_fn(struct request_queue *q) ...@@ -1509,7 +1509,7 @@ static void scsi_request_fn(struct request_queue *q)
int rtn; int rtn;
/* /*
* get next queueable request. We do this early to make sure * get next queueable request. We do this early to make sure
* that the request is fully prepared even if we cannot * that the request is fully prepared even if we cannot
* accept it. * accept it.
*/ */
req = blk_peek_request(q); req = blk_peek_request(q);
...@@ -2147,9 +2147,9 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state) ...@@ -2147,9 +2147,9 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state)
return 0; return 0;
illegal: illegal:
SCSI_LOG_ERROR_RECOVERY(1, SCSI_LOG_ERROR_RECOVERY(1,
sdev_printk(KERN_ERR, sdev, sdev_printk(KERN_ERR, sdev,
"Illegal state transition %s->%s\n", "Illegal state transition %s->%s",
scsi_device_state_name(oldstate), scsi_device_state_name(oldstate),
scsi_device_state_name(state)) scsi_device_state_name(state))
); );
......
...@@ -194,7 +194,7 @@ static void scsi_unlock_floptical(struct scsi_device *sdev, ...@@ -194,7 +194,7 @@ static void scsi_unlock_floptical(struct scsi_device *sdev,
{ {
unsigned char scsi_cmd[MAX_COMMAND_SIZE]; unsigned char scsi_cmd[MAX_COMMAND_SIZE];
printk(KERN_NOTICE "scsi: unlocking floptical drive\n"); sdev_printk(KERN_NOTICE, sdev, "unlocking floptical drive\n");
scsi_cmd[0] = MODE_SENSE; scsi_cmd[0] = MODE_SENSE;
scsi_cmd[1] = 0; scsi_cmd[1] = 0;
scsi_cmd[2] = 0x2e; scsi_cmd[2] = 0x2e;
...@@ -596,8 +596,8 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, ...@@ -596,8 +596,8 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result,
HZ / 2 + HZ * scsi_inq_timeout, 3, HZ / 2 + HZ * scsi_inq_timeout, 3,
&resid); &resid);
SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: INQUIRY %s " SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev,
"with code 0x%x\n", "scsi scan: INQUIRY %s with code 0x%x\n",
result ? "failed" : "successful", result)); result ? "failed" : "successful", result));
if (result) { if (result) {
...@@ -667,9 +667,10 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, ...@@ -667,9 +667,10 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result,
} }
} else if (pass == 2) { } else if (pass == 2) {
printk(KERN_INFO "scsi scan: %d byte inquiry failed. " sdev_printk(KERN_INFO, sdev,
"Consider BLIST_INQUIRY_36 for this device\n", "scsi scan: %d byte inquiry failed. "
try_inquiry_len); "Consider BLIST_INQUIRY_36 for this device\n",
try_inquiry_len);
/* If this pass failed, the third pass goes back and transfers /* If this pass failed, the third pass goes back and transfers
* the same amount as we successfully got in the first pass. */ * the same amount as we successfully got in the first pass. */
...@@ -702,8 +703,9 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, ...@@ -702,8 +703,9 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result,
* strings. * strings.
*/ */
if (sdev->inquiry_len < 36) { if (sdev->inquiry_len < 36) {
printk(KERN_INFO "scsi scan: INQUIRY result too short (%d)," sdev_printk(KERN_INFO, sdev,
" using 36\n", sdev->inquiry_len); "scsi scan: INQUIRY result too short (%d),"
" using 36\n", sdev->inquiry_len);
sdev->inquiry_len = 36; sdev->inquiry_len = 36;
} }
...@@ -822,7 +824,8 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result, ...@@ -822,7 +824,8 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
sdev->writeable = 0; sdev->writeable = 0;
break; break;
default: default:
printk(KERN_INFO "scsi: unknown device type %d\n", sdev->type); sdev_printk(KERN_INFO, sdev, "unknown device type %d\n",
sdev->type);
} }
if (sdev->type == TYPE_RBC || sdev->type == TYPE_ROM) { if (sdev->type == TYPE_RBC || sdev->type == TYPE_ROM) {
...@@ -1044,7 +1047,7 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget, ...@@ -1044,7 +1047,7 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
sdev = scsi_device_lookup_by_target(starget, lun); sdev = scsi_device_lookup_by_target(starget, lun);
if (sdev) { if (sdev) {
if (rescan || !scsi_device_created(sdev)) { if (rescan || !scsi_device_created(sdev)) {
SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev,
"scsi scan: device exists on %s\n", "scsi scan: device exists on %s\n",
dev_name(&sdev->sdev_gendev))); dev_name(&sdev->sdev_gendev)));
if (sdevp) if (sdevp)
...@@ -1131,7 +1134,7 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget, ...@@ -1131,7 +1134,7 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
if (((result[0] >> 5) == 1 || starget->pdt_1f_for_no_lun) && if (((result[0] >> 5) == 1 || starget->pdt_1f_for_no_lun) &&
(result[0] & 0x1f) == 0x1f && (result[0] & 0x1f) == 0x1f &&
!scsi_is_wlun(lun)) { !scsi_is_wlun(lun)) {
SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev,
"scsi scan: peripheral device type" "scsi scan: peripheral device type"
" of 31, no device added\n")); " of 31, no device added\n"));
res = SCSI_SCAN_TARGET_PRESENT; res = SCSI_SCAN_TARGET_PRESENT;
...@@ -1185,8 +1188,8 @@ static void scsi_sequential_lun_scan(struct scsi_target *starget, ...@@ -1185,8 +1188,8 @@ static void scsi_sequential_lun_scan(struct scsi_target *starget,
u64 sparse_lun, lun; u64 sparse_lun, lun;
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: Sequential scan of" SCSI_LOG_SCAN_BUS(3, starget_printk(KERN_INFO, starget,
"%s\n", dev_name(&starget->dev))); "scsi scan: Sequential scan\n"));
max_dev_lun = min(max_scsi_luns, shost->max_lun); max_dev_lun = min(max_scsi_luns, shost->max_lun);
/* /*
...@@ -1431,17 +1434,19 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, ...@@ -1431,17 +1434,19 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
* a retry. * a retry.
*/ */
for (retries = 0; retries < 3; retries++) { for (retries = 0; retries < 3; retries++) {
SCSI_LOG_SCAN_BUS(3, printk (KERN_INFO "scsi scan: Sending" SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev,
" REPORT LUNS to %s (try %d)\n", devname, "scsi scan: Sending REPORT LUNS to (try %d)\n",
retries)); retries));
result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE,
lun_data, length, &sshdr, lun_data, length, &sshdr,
SCSI_TIMEOUT + 4 * HZ, 3, NULL); SCSI_TIMEOUT + 4 * HZ, 3, NULL);
SCSI_LOG_SCAN_BUS(3, printk (KERN_INFO "scsi scan: REPORT LUNS" SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev,
" %s (try %d) result 0x%x\n", result "scsi scan: REPORT LUNS"
? "failed" : "successful", retries, result)); " %s (try %d) result 0x%x\n",
result ? "failed" : "successful",
retries, result));
if (result == 0) if (result == 0)
break; break;
else if (scsi_sense_valid(&sshdr)) { else if (scsi_sense_valid(&sshdr)) {
...@@ -1467,10 +1472,11 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, ...@@ -1467,10 +1472,11 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
num_luns = (length / sizeof(struct scsi_lun)); num_luns = (length / sizeof(struct scsi_lun));
if (num_luns > max_scsi_report_luns) { if (num_luns > max_scsi_report_luns) {
printk(KERN_WARNING "scsi: On %s only %d (max_scsi_report_luns)" sdev_printk(KERN_WARNING, sdev,
" of %d luns reported, try increasing" "Only %d (max_scsi_report_luns)"
" max_scsi_report_luns.\n", devname, " of %d luns reported, try increasing"
max_scsi_report_luns, num_luns); " max_scsi_report_luns.\n",
max_scsi_report_luns, num_luns);
num_luns = max_scsi_report_luns; num_luns = max_scsi_report_luns;
} }
...@@ -1485,9 +1491,9 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, ...@@ -1485,9 +1491,9 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
lun = scsilun_to_int(lunp); lun = scsilun_to_int(lunp);
if (lun > sdev->host->max_lun) { if (lun > sdev->host->max_lun) {
printk(KERN_WARNING "scsi: %s lun%llu has a LUN larger" sdev_printk(KERN_WARNING, sdev,
" than allowed by the host adapter\n", "lun%llu has a LUN larger than"
devname, lun); " allowed by the host adapter\n", lun);
} else { } else {
int res; int res;
...@@ -1765,8 +1771,7 @@ static struct async_scan_data *scsi_prep_async_scan(struct Scsi_Host *shost) ...@@ -1765,8 +1771,7 @@ static struct async_scan_data *scsi_prep_async_scan(struct Scsi_Host *shost)
return NULL; return NULL;
if (shost->async_scan) { if (shost->async_scan) {
printk("%s called twice for host %d", __func__, shost_printk(KERN_INFO, shost, "%s called twice\n", __func__);
shost->host_no);
dump_stack(); dump_stack();
return NULL; return NULL;
} }
...@@ -1819,8 +1824,7 @@ static void scsi_finish_async_scan(struct async_scan_data *data) ...@@ -1819,8 +1824,7 @@ static void scsi_finish_async_scan(struct async_scan_data *data)
mutex_lock(&shost->scan_mutex); mutex_lock(&shost->scan_mutex);
if (!shost->async_scan) { if (!shost->async_scan) {
printk("%s called twice for host %d", __func__, shost_printk(KERN_INFO, shost, "%s called twice\n", __func__);
shost->host_no);
dump_stack(); dump_stack();
mutex_unlock(&shost->scan_mutex); mutex_unlock(&shost->scan_mutex);
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment