All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Christoph Hellwig <hch@infradead.org>
Cc: James Bottomley <jbottomley@parallels.com>,
	Ewan Milne <emilne@redhat.com>, Robert Elliott <elliott@hp.com>,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH 05/10] scsi: use per-cpu buffer for formatting sense
Date: Thu, 06 Nov 2014 08:37:53 +0100	[thread overview]
Message-ID: <545B2551.2030907@suse.de> (raw)
In-Reply-To: <20141106073313.GA14854@infradead.org>

On 11/06/2014 08:33 AM, Christoph Hellwig wrote:
>> +#define scmd_format_header(b, l, d, t) \
>> +	sdev_format_header(b, l, (d) ? (d)->disk_name : NULL, t)
> 
> I'd rather have a
> 
> static inline const char *scmd_name(struct scsi_cmnd *scmd)
> {
> 	return scmd->request->rq_disk ?
> 		scmd->request->rq_disk->disk_name : NULL;
> }
> 
> helper and use that directlu, which also gets rid of all the
> local gendisk variables.
> 
Ok.

>> +	if (scsi_sense_is_deferred(sshdr))
>> +		off += scnprintf(buffer + off, buf_len - off, "[deferred] ");
>> +	else
>> +		off += scnprintf(buffer + off, buf_len - off, "[current] ");
> 
> 	off += scnprintf(buffer + off, buf_len - off,
> 		scsi_sense_is_deferred(sshdr) ? "[deferred] " : "[current] ");
> 
>> +{
>> +	struct scsi_sense_hdr sshdr;
>> +
>> +	if (!scsi_normalize_sense(sense_buffer, sense_len, &sshdr)) {
>> +		int i;
>> +
>> +		for (i = 0; i < sense_len; i += 16) {
>> +			char *logbuf;
>> +			int len = min(sense_len - i, 16);
>> +			size_t off, logbuf_len;
>> +
>> +			logbuf = scsi_log_reserve_buffer(&logbuf_len);
>> +			if (!logbuf)
>> +				break;
>> +			off = sdev_format_header(logbuf, logbuf_len,
>> +						 name, tag);
>> +			hex_dump_to_buffer(&sense_buffer[i], len, 16, 1,
>> +					   logbuf + off, logbuf_len - off,
>> +					   false);
>> +			dev_printk(KERN_INFO, &sdev->sdev_gendev, logbuf);
>> +			scsi_log_release_buffer(logbuf);
>> +		}
>> +		return;
> 
> Keeping the code inside the if in a separate helper would probably be a
> lot more readable.
> 
Ok. Will be doing so.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-11-06  7:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-04  8:06 [PATCH 00/10] scsi logging update: the real thing Hannes Reinecke
2014-11-04  8:06 ` [PATCH 01/10] scsi: Use real functions for logging Hannes Reinecke
2014-11-04 13:58   ` Christoph Hellwig
2014-11-04 14:22     ` Hannes Reinecke
2014-11-11 17:38   ` Elliott, Robert (Server Storage)
2014-11-11 19:07     ` Hannes Reinecke
2014-11-04  8:06 ` [PATCH 02/10] scsi: log request tag for scmd_printk() Hannes Reinecke
2014-11-06  6:40   ` Christoph Hellwig
2014-11-04  8:06 ` [PATCH 03/10] scsi: use external buffer for command logging Hannes Reinecke
2014-11-06  6:52   ` Christoph Hellwig
2014-11-04  8:06 ` [PATCH 04/10] libata: use __scsi_format_command() Hannes Reinecke
2014-11-06  7:02   ` Christoph Hellwig
2014-11-04  8:06 ` [PATCH 05/10] scsi: use per-cpu buffer for formatting sense Hannes Reinecke
2014-11-06  7:33   ` Christoph Hellwig
2014-11-06  7:37     ` Hannes Reinecke [this message]
2014-11-04  8:06 ` [PATCH 06/10] scsi: use per-cpu buffer for formatting scsi_print_result() Hannes Reinecke
2014-11-04  8:06 ` [PATCH 07/10] scsi: Rename SERVICE_ACTION_IN to SERVICE_ACTION_IN_16 Hannes Reinecke
2014-11-06  7:07   ` Christoph Hellwig
2014-11-04  8:06 ` [PATCH 08/10] scsi: Add SPC-3 command definitions Hannes Reinecke
2014-11-06  7:07   ` Christoph Hellwig
2014-11-04  8:06 ` [PATCH 09/10] scsi: Conditionally compile in constants.c Hannes Reinecke
2014-11-06  7:19   ` Christoph Hellwig
2014-11-04  8:06 ` [PATCH 10/10] scsi: Move remaining printk() statement to scmd_printk() Hannes Reinecke
2014-11-06  7:20   ` Christoph Hellwig
2014-11-06  7:37     ` Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=545B2551.2030907@suse.de \
    --to=hare@suse.de \
    --cc=elliott@hp.com \
    --cc=emilne@redhat.com \
    --cc=hch@infradead.org \
    --cc=jbottomley@parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.