ata: libata: Add helper ata_eh_decide_disposition()
authorNiklas Cassel <cassel@kernel.org>
Wed, 28 Aug 2024 07:27:04 +0000 (09:27 +0200)
committerDamien Le Moal <dlemoal@kernel.org>
Thu, 29 Aug 2024 01:06:11 +0000 (10:06 +0900)
commit9526dec226f0779d72f798e7a18375bf8d414775
tree97bfadd80a59214718c44c36198420aa589893be
parent43d37fffda9b7ad10ae90122ea532a829bdd2f92
ata: libata: Add helper ata_eh_decide_disposition()

Every time I see libata code calling scsi_check_sense(), I get confused
why the code path that is working fine for SCSI code, is not sufficient
for libata code.

The reason is that SCSI usually gets the sense data as part of the
completion, and will thus automatically call scsi_check_sense(), which
will set the SCSI ML byte (if any).

However, for libata queued commands, we always need to fetch the sense
data via SCSI EH, and thus do not get the luxury of having
scsi_check_sense() called automatically.

Add a new helper, ata_eh_decide_disposition(), that has a ata_eh_ prefix
to more clearly highlight that this is only needed for code called by EH,
while also having a similar name to scsi_decide_disposition(), such that
it is easier to compare the libata code with the equivalent SCSI code.

Also add a big kdoc comment explaining why this helper is called/needed in
the first place.

Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
drivers/ata/libata-eh.c
drivers/ata/libata-sata.c
drivers/ata/libata.h