Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Niklas Cassel <nks@flawful.org>
Cc: Niklas Cassel <niklas.cassel@wdc.com>, linux-ide@vger.kernel.org
Subject: Re: [PATCH] ata: libata-eh: Clarify ata_eh_qc_retry() behavior at call site
Date: Mon, 22 May 2023 09:48:24 +0900	[thread overview]
Message-ID: <9cec80a5-9846-d1a4-9a9a-27ed9b510445@kernel.org> (raw)
In-Reply-To: <20230519104003.37843-1-nks@flawful.org>

On 5/19/23 19:40, Niklas Cassel wrote:
> From: Niklas Cassel <niklas.cassel@wdc.com>
> 
> While the function documentation for ata_eh_qc_retry() is clear,
> from simply reading the single function that calls ata_eh_qc_retry(),
> it is not clear that ata_eh_qc_retry() might not retry the command.
> 
> Add a comment in the single function that calls ata_eh_qc_retry() to
> clarify the behavior.

Looks good. But may be resend this rebased on top of Hannes v2 of the error
handler cleanup once he sends it ?

> 
> Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
> ---
>  drivers/ata/libata-eh.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
> index a6c901811802..170326dc1073 100644
> --- a/drivers/ata/libata-eh.c
> +++ b/drivers/ata/libata-eh.c
> @@ -3814,6 +3814,12 @@ void ata_eh_finish(struct ata_port *ap)
>  			 * considering both err_mask and tf.
>  			 */
>  			if (qc->flags & ATA_QCFLAG_RETRY)
> +				/*
> +				 * Since qc->err_mask is set, ata_eh_qc_retry()
> +				 * will not increment scmd->allowed, so upper
> +				 * layer will only retry the command if it has
> +				 * not already been retried too many times.
> +				 */
>  				ata_eh_qc_retry(qc);
>  			else
>  				ata_eh_qc_complete(qc);
> @@ -3823,6 +3829,12 @@ void ata_eh_finish(struct ata_port *ap)
>  			} else {
>  				/* feed zero TF to sense generation */
>  				memset(&qc->result_tf, 0, sizeof(qc->result_tf));
> +				/*
> +				 * Since qc->err_mask is not set,
> +				 * ata_eh_qc_retry() will increment
> +				 * scmd->allowed, so upper layer is guaranteed
> +				 * to retry the command.
> +				 */
>  				ata_eh_qc_retry(qc);
>  			}
>  		}

-- 
Damien Le Moal
Western Digital Research


  reply	other threads:[~2023-05-22  0:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19 10:40 [PATCH] ata: libata-eh: Clarify ata_eh_qc_retry() behavior at call site Niklas Cassel
2023-05-22  0:48 ` Damien Le Moal [this message]
2023-05-31 16:09   ` Niklas Cassel
2023-06-01  0:16 ` Damien Le Moal

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=9cec80a5-9846-d1a4-9a9a-27ed9b510445@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=niklas.cassel@wdc.com \
    --cc=nks@flawful.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox