public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: <axboe@kernel.dk>, <damien.lemoal@opensource.wdc.com>,
	<jejb@linux.ibm.com>, <martin.petersen@oracle.com>,
	<brking@us.ibm.com>, <hare@suse.de>, <hch@lst.de>
Cc: <linux-block@vger.kernel.org>, <linux-ide@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-scsi@vger.kernel.org>,
	<chenxiang66@hisilicon.com>, John Garry <john.garry@huawei.com>
Subject: [PATCH RFC v2 07/18] libata-scsi: Add ata_internal_queuecommand()
Date: Thu, 9 Jun 2022 18:29:08 +0800	[thread overview]
Message-ID: <1654770559-101375-8-git-send-email-john.garry@huawei.com> (raw)
In-Reply-To: <1654770559-101375-1-git-send-email-john.garry@huawei.com>

Add callback to queue reserved commands - call it "internal" as this is
what libata uses.

Also add it to the base ATA SHT, and set nr_reserved_cmds = 1, which
matches tag ATA_TAG_INTERNAL.

Signed-off-by: John Garry <john.garry@huawei.com>
---
 drivers/ata/libata-scsi.c | 14 ++++++++++++++
 include/linux/libata.h    |  6 +++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index baac35dd17ca..b2702ab0183b 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1114,6 +1114,20 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev)
 	return 0;
 }
 
+int ata_internal_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
+{
+	struct ata_port *ap;
+	int res;
+
+	ap = ata_shost_to_port(shost);
+	spin_lock_irq(ap->lock);
+	res = ata_sas_queuecmd(scmd, ap);
+	spin_unlock_irq(ap->lock);
+
+	return res;
+}
+EXPORT_SYMBOL_GPL(ata_internal_queuecommand);
+
 /**
  *	ata_scsi_slave_config - Set SCSI device attributes
  *	@sdev: SCSI device to examine
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 43f4bcfe9a5f..5fa6f56bba81 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1141,6 +1141,8 @@ extern int ata_std_bios_param(struct scsi_device *sdev,
 			      sector_t capacity, int geom[]);
 extern void ata_scsi_unlock_native_capacity(struct scsi_device *sdev);
 extern int ata_scsi_slave_config(struct scsi_device *sdev);
+extern int ata_internal_queuecommand(struct Scsi_Host *shost,
+				struct scsi_cmnd *scmd);
 extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
 extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
 				       int queue_depth);
@@ -1390,7 +1392,9 @@ extern const struct attribute_group *ata_common_sdev_groups[];
 	.proc_name		= drv_name,			\
 	.slave_destroy		= ata_scsi_slave_destroy,	\
 	.bios_param		= ata_std_bios_param,		\
-	.unlock_native_capacity	= ata_scsi_unlock_native_capacity
+	.unlock_native_capacity	= ata_scsi_unlock_native_capacity,\
+	.nr_reserved_cmds = 1,\
+	.reserved_queuecommand = ata_internal_queuecommand
 
 #define ATA_SUBBASE_SHT(drv_name)				\
 	__ATA_BASE_SHT(drv_name),				\
-- 
2.26.2


  parent reply	other threads:[~2022-06-09 10:36 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09 10:29 [PATCH RFC v2 00/18] blk-mq/libata/scsi: SCSI driver tagging improvements John Garry
2022-06-09 10:29 ` [PATCH RFC v2 01/18] blk-mq: Add a flag for reserved requests John Garry
2022-06-14  6:43   ` Christoph Hellwig
2022-06-14  9:29     ` John Garry
2022-06-14 18:00   ` Bart Van Assche
2022-06-14 18:30     ` John Garry
2022-06-09 10:29 ` [PATCH RFC v2 02/18] scsi: core: Resurrect scsi_{get,free}_host_dev() John Garry
2022-06-14  6:44   ` Christoph Hellwig
2022-06-14  9:33     ` John Garry
2022-06-14 19:33   ` Bart Van Assche
2022-06-15 13:44     ` John Garry
2022-06-09 10:29 ` [PATCH RFC v2 03/18] scsi: core: Implement reserved command handling John Garry
2022-06-13  7:01   ` Damien Le Moal
2022-06-13  8:25     ` John Garry
2022-06-13  9:06       ` Damien Le Moal
2022-06-13  9:34         ` John Garry
2022-06-13  9:43           ` Damien Le Moal
2022-06-13 10:05             ` John Garry
2022-06-20  6:45         ` Hannes Reinecke
2022-06-20  7:06           ` Damien Le Moal
2022-06-14 18:20     ` Bart Van Assche
2022-06-14 23:43       ` Damien Le Moal
2022-06-15  7:35         ` John Garry
2022-06-16  2:47           ` Damien Le Moal
2022-06-16  8:24             ` John Garry
2022-06-16  8:41               ` Damien Le Moal
2022-06-20  8:27                 ` Hannes Reinecke
2022-06-20  9:02                   ` Damien Le Moal
2022-06-20  9:05                     ` Christoph Hellwig
2022-06-20 11:24                       ` Damien Le Moal
2022-06-20 11:56                         ` Hannes Reinecke
2022-06-20  8:02           ` Hannes Reinecke
2022-06-20  6:24     ` Hannes Reinecke
2022-06-20  6:28       ` Christoph Hellwig
2022-06-20  7:03         ` Hannes Reinecke
2022-06-20  7:14           ` Damien Le Moal
2022-06-09 10:29 ` [PATCH RFC v2 04/18] scsi: core: Add support to send reserved commands John Garry
2022-06-13  7:03   ` Damien Le Moal
2022-06-13  9:40     ` John Garry
2022-06-13  9:41       ` Damien Le Moal
2022-06-09 10:29 ` [PATCH RFC v2 05/18] scsi: core: Allocate SCSI host sdev when required John Garry
2022-06-09 10:29 ` [PATCH RFC v2 06/18] libata-scsi: Add ata_scsi_queue_internal() John Garry
2022-06-13  7:12   ` Damien Le Moal
2022-06-13  9:41     ` John Garry
2022-06-09 10:29 ` John Garry [this message]
2022-06-13  7:16   ` [PATCH RFC v2 07/18] libata-scsi: Add ata_internal_queuecommand() Damien Le Moal
2022-06-13  9:44     ` John Garry
2022-06-09 10:29 ` [PATCH RFC v2 08/18] libata: Queue ATA internal commands as requests John Garry
2022-06-13  7:22   ` Damien Le Moal
2022-06-13  8:13     ` John Garry
2022-06-09 10:29 ` [PATCH RFC v2 09/18] scsi: ipr: Support reserved commands John Garry
2022-06-09 10:29 ` [PATCH RFC v2 10/18] libata/scsi: libsas: Add sas_queuecommand_internal() John Garry
2022-06-09 10:29 ` [PATCH RFC v2 11/18] scsi: libsas: Don't attempt to find scsi host rphy in slave alloc John Garry
2022-06-09 10:29 ` [PATCH RFC v2 12/18] scsi: libsas drivers: Prepare for reserved commands John Garry
2022-06-09 10:29 ` [PATCH RFC v2 13/18] scsi: libsas: Allocate SCSI commands for tasks John Garry
2022-06-09 10:29 ` [PATCH RFC v2 14/18] scsi: libsas: Queue SMP commands as requests John Garry
2022-06-09 10:29 ` [PATCH RFC v2 15/18] scsi: libsas: Queue TMF " John Garry
2022-06-09 10:29 ` [PATCH RFC v2 16/18] scsi: core: Add scsi_alloc_request_hwq() John Garry
2022-06-09 10:29 ` [PATCH RFC v2 17/18] scsi: libsas: Queue internal abort commands as requests John Garry
2022-06-09 10:29 ` [PATCH RFC v2 18/18] scsi: libsas drivers: Remove private tag management John Garry

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=1654770559-101375-8-git-send-email-john.garry@huawei.com \
    --to=john.garry@huawei.com \
    --cc=axboe@kernel.dk \
    --cc=brking@us.ibm.com \
    --cc=chenxiang66@hisilicon.com \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=jejb@linux.ibm.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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