From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: John Garry <john.garry@huawei.com>,
jejb@linux.ibm.com, martin.petersen@oracle.com,
jinpu.wang@cloud.ionos.com, damien.lemoal@wdc.com
Cc: hare@suse.de, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org, linuxarm@huawei.com,
ipylypiv@google.com, changyuanl@google.com, hch@lst.de
Subject: Re: [PATCH 2/6] scsi: hisi_sas: Use sas_task_find_rq()
Date: Thu, 29 Sep 2022 11:11:34 +0900 [thread overview]
Message-ID: <4737cbca-6250-00b8-a2be-1d98e2b8d04a@opensource.wdc.com> (raw)
In-Reply-To: <1664368034-114991-3-git-send-email-john.garry@huawei.com>
On 9/28/22 21:27, John Garry wrote:
> Use sas_task_find_rq() to lookup the request per task for its driver tag.
>
> Signed-off-by: John Garry <john.garry@huawei.com>
Looks good, modulo the question below.
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> ---
> drivers/scsi/hisi_sas/hisi_sas_main.c | 26 ++++++++------------------
> 1 file changed, 8 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
> index 4c37ae9eb6b6..1011dffed51f 100644
> --- a/drivers/scsi/hisi_sas/hisi_sas_main.c
> +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
> @@ -177,13 +177,13 @@ static void hisi_sas_slot_index_set(struct hisi_hba *hisi_hba, int slot_idx)
> }
>
> static int hisi_sas_slot_index_alloc(struct hisi_hba *hisi_hba,
> - struct scsi_cmnd *scsi_cmnd)
> + struct request *rq)
> {
> int index;
> void *bitmap = hisi_hba->slot_index_tags;
>
> - if (scsi_cmnd)
> - return scsi_cmd_to_rq(scsi_cmnd)->tag;
> + if (rq)
> + return rq->tag;
>
> spin_lock(&hisi_hba->lock);
> index = find_next_zero_bit(bitmap, hisi_hba->slot_index_count,
> @@ -461,11 +461,11 @@ static int hisi_sas_queue_command(struct sas_task *task, gfp_t gfp_flags)
> struct asd_sas_port *sas_port = device->port;
> struct hisi_sas_device *sas_dev = device->lldd_dev;
> bool internal_abort = sas_is_internal_abort(task);
> - struct scsi_cmnd *scmd = NULL;
> struct hisi_sas_dq *dq = NULL;
> struct hisi_sas_port *port;
> struct hisi_hba *hisi_hba;
> struct hisi_sas_slot *slot;
> + struct request *rq = NULL;
Do you really need the NULL initialization here ?
> struct device *dev;
> int rc;
>
> @@ -520,22 +520,12 @@ static int hisi_sas_queue_command(struct sas_task *task, gfp_t gfp_flags)
> return -ECOMM;
> }
>
> - if (task->uldd_task) {
> - struct ata_queued_cmd *qc;
> -
> - if (dev_is_sata(device)) {
> - qc = task->uldd_task;
> - scmd = qc->scsicmd;
> - } else {
> - scmd = task->uldd_task;
> - }
> - }
> -
> - if (scmd) {
> + rq = sas_task_find_rq(task);
> + if (rq) {
> unsigned int dq_index;
> u32 blk_tag;
>
> - blk_tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmd));
> + blk_tag = blk_mq_unique_tag(rq);
> dq_index = blk_mq_unique_tag_to_hwq(blk_tag);
> dq = &hisi_hba->dq[dq_index];
> } else {
> @@ -580,7 +570,7 @@ static int hisi_sas_queue_command(struct sas_task *task, gfp_t gfp_flags)
> if (!internal_abort && hisi_hba->hw->slot_index_alloc)
> rc = hisi_hba->hw->slot_index_alloc(hisi_hba, device);
> else
> - rc = hisi_sas_slot_index_alloc(hisi_hba, scmd);
> + rc = hisi_sas_slot_index_alloc(hisi_hba, rq);
>
> if (rc < 0)
> goto err_out_dif_dma_unmap;
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2022-09-29 2:11 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-28 12:27 [PATCH 0/6] scsi: libsas: Use request tag in more drivers John Garry
2022-09-28 12:27 ` [PATCH 1/6] scsi: libsas: Add sas_task_find_rq() John Garry
2022-09-28 13:13 ` Jason Yan
2022-09-28 13:50 ` John Garry
2022-09-28 14:38 ` Jason Yan
2022-09-28 13:17 ` Johannes Thumshirn
2022-09-28 13:56 ` John Garry
2022-09-28 14:28 ` Johannes Thumshirn
2022-09-29 2:09 ` Damien Le Moal
2022-09-29 7:33 ` John Garry
2022-09-29 7:56 ` Damien Le Moal
2022-09-28 12:27 ` [PATCH 2/6] scsi: hisi_sas: Use sas_task_find_rq() John Garry
2022-09-29 2:11 ` Damien Le Moal [this message]
2022-09-29 7:38 ` John Garry
2022-09-28 12:27 ` [PATCH 3/6] scsi: pm8001: Remove pm8001_tag_init() John Garry
2022-09-29 2:13 ` Damien Le Moal
2022-09-28 12:27 ` [PATCH 4/6] scsi: pm8001: Use sas_task_find_rq() for tagging John Garry
2022-09-29 2:17 ` Damien Le Moal
2022-09-29 7:41 ` John Garry
2022-09-28 12:27 ` [PATCH 5/6] scsi: mvsas: Delete mvs_tag_init() John Garry
2022-09-29 2:18 ` Damien Le Moal
2022-09-28 12:27 ` [PATCH 6/6] scsi: mvsas: Use sas_task_find_rq() for tagging John Garry
2022-09-29 2:22 ` Damien Le Moal
2022-09-29 7:49 ` John Garry
2022-09-29 8:02 ` Damien Le Moal
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=4737cbca-6250-00b8-a2be-1d98e2b8d04a@opensource.wdc.com \
--to=damien.lemoal@opensource.wdc.com \
--cc=changyuanl@google.com \
--cc=damien.lemoal@wdc.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=ipylypiv@google.com \
--cc=jejb@linux.ibm.com \
--cc=jinpu.wang@cloud.ionos.com \
--cc=john.garry@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxarm@huawei.com \
--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