[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1654770559-101375-16-git-send-email-john.garry@huawei.com>
Date: Thu, 9 Jun 2022 18:29:16 +0800
From: John Garry <john.garry@...wei.com>
To: <axboe@...nel.dk>, <damien.lemoal@...nsource.wdc.com>,
<jejb@...ux.ibm.com>, <martin.petersen@...cle.com>,
<brking@...ibm.com>, <hare@...e.de>, <hch@....de>
CC: <linux-block@...r.kernel.org>, <linux-ide@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-scsi@...r.kernel.org>,
<chenxiang66@...ilicon.com>, John Garry <john.garry@...wei.com>
Subject: [PATCH RFC v2 15/18] scsi: libsas: Queue TMF commands as requests
Like what we did with SMP commands, send TMF commands through the block
layer.
In future we can now also take advantage of the block layer request
timeout handling.
Signed-off-by: John Garry <john.garry@...wei.com>
---
drivers/scsi/libsas/sas_scsi_host.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index f0566f4512b2..520c301e4319 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -1059,18 +1059,27 @@ int sas_execute_tmf(struct domain_device *device, void *parameter,
struct sas_task *task;
struct sas_internal *i =
to_sas_internal(device->port->ha->core.shost->transportt);
- struct sas_ha_struct *ha = device->port->ha;
int res, retry;
-
+ struct request *rq;
+ struct sas_ha_struct *ha = device->port->ha;
for (retry = 0; retry < TASK_RETRY; retry++) {
+ struct scsi_cmnd *scmd;
+
task = sas_alloc_slow_task(ha, GFP_KERNEL);
- if (!task)
- return -ENOMEM;
+ if (!task) {
+ res = -ENOMEM;
+ break;
+ }
task->dev = device;
task->task_proto = device->tproto;
+ rq = sas_rq_from_task(task);
+
+ scmd = blk_mq_rq_to_pdu(rq);
+ ASSIGN_SAS_TASK(scmd, task);
+
if (dev_is_sata(device)) {
task->ata_task.device_control_reg_update = 1;
if (force_phy_id >= 0) {
@@ -1082,20 +1091,15 @@ int sas_execute_tmf(struct domain_device *device, void *parameter,
memcpy(&task->ssp_task, parameter, para_len);
}
- task->task_done = sas_task_internal_done;
+ task->task_done = sas_task_complete_internal;
task->tmf = tmf;
task->slow_task->timer.function = sas_task_internal_timedout;
task->slow_task->timer.expires = jiffies + TASK_TIMEOUT;
add_timer(&task->slow_task->timer);
- res = i->dft->lldd_execute_task(task, GFP_KERNEL);
- if (res) {
- del_timer_sync(&task->slow_task->timer);
- pr_err("executing TMF task failed %016llx (%d)\n",
- SAS_ADDR(device->sas_addr), res);
- break;
- }
+ rq->end_io = sas_blk_end_sync_rq;
+ blk_execute_rq_nowait(rq, true);
wait_for_completion(&task->slow_task->completion);
--
2.26.2
Powered by blists - more mailing lists