Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: John Garry <john.g.garry@oracle.com>
To: Bart Van Assche <bvanassche@acm.org>,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>,
	Damien Le Moal <damien.lemoal@opensource.wdc.com>,
	Mike Christie <michael.christie@oracle.com>,
	Ming Lei <ming.lei@redhat.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>
Subject: Re: [PATCH] scsi: core: Report error list information in debugfs
Date: Tue, 22 Aug 2023 17:24:54 +0100	[thread overview]
Message-ID: <2f74af74-9311-d4ab-ff06-2ab805c1806d@oracle.com> (raw)
In-Reply-To: <9c32fc0f-b14e-9f7d-7ebc-11c0710d6365@acm.org>

On 22/08/2023 16:25, Bart Van Assche wrote:
> On 8/22/23 02:04, John Garry wrote:
>> If it's on the first list, then there is not much point in checking 
>> this list.
>> It might be even worth checking list_empty(&cmd->eh_entry) initially 
>> also to
>> save the bother.
>>
>> Having said all this, adding those checks will add lots of unpleasant 
>> indentation...
> 
> Since the above code is only used to export information through debugfs 
> I don't
> think that it should be optimized heavily? 

To me it's not really a matter of having the code optimized, but more 
about having clear and efficient code.

> Anyway, how about combining the
> (untested) patch below with the above patch?
> 
> diff --git a/drivers/scsi/scsi_debugfs.c b/drivers/scsi/scsi_debugfs.c
> index a9bc5f7ce745..f795848b316c 100644
> --- a/drivers/scsi/scsi_debugfs.c
> +++ b/drivers/scsi/scsi_debugfs.c
> @@ -45,15 +45,16 @@ void scsi_show_rq(struct seq_file *m, struct request 
> *rq)
>       list_for_each_entry(cmd2, &shost->eh_abort_list, eh_entry) {
>           if (cmd == cmd2) {
>               list_info = "on eh_abort_list";
> -            break;
> +            goto unlock;
>           }
>       }
>       list_for_each_entry(cmd2, &shost->eh_cmd_q, eh_entry) {
>           if (cmd == cmd2) {
>               list_info = "on eh_cmd_q";
> -            break;
> +            goto unlock;
>           }
>       }

I think that list_info could be set to NULL here, rather than when declared.

> +unlock:
>       spin_unlock_irq(shost->host_lock);
> 
>       __scsi_format_command(buf, sizeof(buf), cmd->cmnd, cmd->cmd_len);

Regardless of comment, above:
Reviewed-by: John Garry <john.g.garry@oracle.com>

thanks

  reply	other threads:[~2023-08-22 16:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-21 20:41 [PATCH] scsi: core: Report error list information in debugfs Bart Van Assche
2023-08-22  5:52 ` Damien Le Moal
2023-08-22  9:04 ` John Garry
2023-08-22 15:25   ` Bart Van Assche
2023-08-22 16:24     ` John Garry [this message]
2023-10-09  7:12 ` 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=2f74af74-9311-d4ab-ff06-2ab805c1806d@oracle.com \
    --to=john.g.garry@oracle.com \
    --cc=bvanassche@acm.org \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=hare@suse.de \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michael.christie@oracle.com \
    --cc=ming.lei@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox