Re: [PATCH RFC 2/2] libata: Use scsi cmnd budget token for qc tag for SAS host

From: John Garry
Date: Wed Mar 16 2022 - 06:47:06 EST


On 16/03/2022 08:34, Christoph Hellwig wrote:
In addition to the comments from Damien: I think we should kill
ata_qc_new_init as well. It is a bit pointless and having it in
libata-core.c when it pokes into scsi internals also doesn't make sense.

So maybe something like:

Seems reasonable to me at least.

But I'd send these as 2x separate patches.

* sata_async_notification - SATA async notification handler
* @ap: ATA port where async notification is received
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index ed8be585a98f7c..5e0bc7b05a107e 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -638,24 +638,44 @@ EXPORT_SYMBOL_GPL(ata_scsi_ioctl);
static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
struct scsi_cmnd *cmd)
{
...

- if (scsi_cmd_to_rq(cmd)->rq_flags & RQF_QUIET)
- qc->flags |= ATA_QCFLAG_QUIET;
+ if (ap->flags & ATA_FLAG_SAS_HOST) {
+ /* XXX: add a comment here why SAS is different */

I think this is simply because SAS hosts have shost.can_queue > 32

+ if (WARN_ON_ONCE(cmd->budget_token >= ATA_MAX_QUEUE))
+ goto fail;
+ tag = cmd->budget_token;

thanks,
John