diff options
author | Niklas Cassel <niklas.cassel@wdc.com> | 2023-05-19 12:40:02 +0200 |
---|---|---|
committer | Damien Le Moal <dlemoal@kernel.org> | 2023-06-01 02:13:22 +0200 |
commit | e4c26a1b74b559f86905de6443e592f248473fff (patch) | |
tree | 82b5a6f58538320b67fe0c1a1cf87416d11b74b9 /drivers/ata | |
parent | ata: pata_parport: Fix on26 module code indentation and style (diff) | |
download | linux-e4c26a1b74b559f86905de6443e592f248473fff.tar.xz linux-e4c26a1b74b559f86905de6443e592f248473fff.zip |
ata: libata-eh: Clarify ata_eh_qc_retry() behavior at call site
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.
[Damien] Added curly braces to "if () else" with multi-line comment.
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-eh.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index a6c901811802..c7336a0a884d 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -3813,16 +3813,29 @@ void ata_eh_finish(struct ata_port *ap) * generate sense data in this function, * considering both err_mask and tf. */ - if (qc->flags & ATA_QCFLAG_RETRY) + 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 + } else { ata_eh_qc_complete(qc); + } } else { if (qc->flags & ATA_QCFLAG_SENSE_VALID) { ata_eh_qc_complete(qc); } 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); } } |