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();
......
...@@ -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
...@@ -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,8 +750,8 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) ...@@ -750,8 +750,8 @@ 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));
/* /*
...@@ -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;
} }
...@@ -2149,7 +2149,7 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state) ...@@ -2149,7 +2149,7 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state)
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,7 +667,8 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, ...@@ -667,7 +667,8 @@ 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,
"scsi scan: %d byte inquiry failed. "
"Consider BLIST_INQUIRY_36 for this device\n", "Consider BLIST_INQUIRY_36 for this device\n",
try_inquiry_len); try_inquiry_len);
...@@ -702,7 +703,8 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, ...@@ -702,7 +703,8 @@ 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,
"scsi scan: INQUIRY result too short (%d),"
" using 36\n", sdev->inquiry_len); " 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,9 +1472,10 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, ...@@ -1467,9 +1472,10 @@ 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,
"Only %d (max_scsi_report_luns)"
" of %d luns reported, try increasing" " of %d luns reported, try increasing"
" max_scsi_report_luns.\n", devname, " max_scsi_report_luns.\n",
max_scsi_report_luns, num_luns); 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