Skip to content

Commit e4c26a1

Browse files
Niklas Casseldamien-lemoal
authored andcommitted
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 <[email protected]> Signed-off-by: Damien Le Moal <[email protected]>
1 parent a5ae12c commit e4c26a1

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

drivers/ata/libata-eh.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3813,16 +3813,29 @@ void ata_eh_finish(struct ata_port *ap)
38133813
* generate sense data in this function,
38143814
* considering both err_mask and tf.
38153815
*/
3816-
if (qc->flags & ATA_QCFLAG_RETRY)
3816+
if (qc->flags & ATA_QCFLAG_RETRY) {
3817+
/*
3818+
* Since qc->err_mask is set, ata_eh_qc_retry()
3819+
* will not increment scmd->allowed, so upper
3820+
* layer will only retry the command if it has
3821+
* not already been retried too many times.
3822+
*/
38173823
ata_eh_qc_retry(qc);
3818-
else
3824+
} else {
38193825
ata_eh_qc_complete(qc);
3826+
}
38203827
} else {
38213828
if (qc->flags & ATA_QCFLAG_SENSE_VALID) {
38223829
ata_eh_qc_complete(qc);
38233830
} else {
38243831
/* feed zero TF to sense generation */
38253832
memset(&qc->result_tf, 0, sizeof(qc->result_tf));
3833+
/*
3834+
* Since qc->err_mask is not set,
3835+
* ata_eh_qc_retry() will increment
3836+
* scmd->allowed, so upper layer is guaranteed
3837+
* to retry the command.
3838+
*/
38263839
ata_eh_qc_retry(qc);
38273840
}
38283841
}

0 commit comments

Comments
 (0)