Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1717805rwb; Thu, 29 Sep 2022 00:55:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5x9pNKhFd6WiFoRpZWKvM04VrXbBbyTHV44CcGQxqFgNsmYfY4qbLbRBFLlmo7PoaeaTGM X-Received: by 2002:a05:6a00:1892:b0:540:acee:29e8 with SMTP id x18-20020a056a00189200b00540acee29e8mr2042869pfh.1.1664438156141; Thu, 29 Sep 2022 00:55:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664438156; cv=none; d=google.com; s=arc-20160816; b=0XqzDbCpJtqyQ1E89vqroVfyip6pRlKwbcmY9IlAR64oplxtiMtstTaxlhp0xKKgy8 D7nPklep0ynrnqqIBhsO2ci3IAb2W3cAYSK82QsW6R55gA5lwuzKMR1SedUVSh0+VvyP omS6KZC+GenKXOVGlmTqOx9p+HulKz1+BFeEmil+N0XbVBvYGK/AefRx8Rl00HdODEr7 KrNtnJ9QNLnKRp0lh0mp+nPKAwsNG/0aT0VToRtYVpchQU374XiRIINeSvUj6xOmoj3Y SE8959mdLVpoVZrimaMIBwIIWxuVaJDJjNekywpYGhuZ1JvNyKSJnkW7COpA86Qx5YDx nPEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=EYhzZbb9xuxC2Fu6qAPJBn9bauYZO1wnk3VZ18j6/eY=; b=vUnowzEWa6Z7FYD8WjAeNoFH6PGegjuT2y4SflsmkFmqC1/eU2GmEYUTUpnleQZe6E 0iZlVB/Oxk23P6/2WcYq2S+3wwWzA/ZJ185tPbq61dcS//IK9vYrJS3xIiVG/2iqgc/S GTk38NHjd9WbHz7pA/jyelboM+blY3FfQxL3K7x0TcLVW3a6/w/jrjUOZsrRbgMOcLDR EMN9D9asHpDhx3ogO01EuxtOPkJPoC46iIMYfLHolVanEAqUadF59egPau5AYG2zK3oo N+HCLjvgNoBO2zgCDyN4byN4QWXvidaXSwWGtaYoFDt+kpSq2exTPgNaGBffLauL2+w5 CEVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i17-20020a17090332d100b00178b95aa01fsi9402840plr.614.2022.09.29.00.55.36; Thu, 29 Sep 2022 00:55:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235317AbiI2Hdr (ORCPT + 99 others); Thu, 29 Sep 2022 03:33:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235003AbiI2Hdc (ORCPT ); Thu, 29 Sep 2022 03:33:32 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC0C7137E49; Thu, 29 Sep 2022 00:33:29 -0700 (PDT) Received: from fraeml738-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MdQ5f1qHtz6J6BD; Thu, 29 Sep 2022 15:31:18 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml738-chm.china.huawei.com (10.206.15.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 29 Sep 2022 09:33:26 +0200 Received: from [10.126.170.84] (10.126.170.84) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 29 Sep 2022 08:33:25 +0100 Message-ID: <1356c5b0-5cd7-b006-1b34-a66a34e23fb4@huawei.com> Date: Thu, 29 Sep 2022 08:33:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH 1/6] scsi: libsas: Add sas_task_find_rq() To: Damien Le Moal , , , , CC: , , , , , , References: <1664368034-114991-1-git-send-email-john.garry@huawei.com> <1664368034-114991-2-git-send-email-john.garry@huawei.com> <0c0306d7-2645-874a-9745-8aa5dcfeede1@opensource.wdc.com> From: John Garry In-Reply-To: <0c0306d7-2645-874a-9745-8aa5dcfeede1@opensource.wdc.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.126.170.84] X-ClientProxiedBy: lhrpeml100006.china.huawei.com (7.191.160.224) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/09/2022 03:09, Damien Le Moal wrote: > On 9/28/22 21:27, John Garry wrote: >> blk-mq already provides a unique tag per request. Some libsas LLDDs - like >> hisi_sas - already use this tag as the unique per-IO HW tag. >> >> Add a common function to provide the request associated with a sas_task >> for all libsas LLDDs. >> >> Signed-off-by: John Garry >> --- >> include/scsi/libsas.h | 22 ++++++++++++++++++++++ >> 1 file changed, 22 insertions(+) >> >> diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h >> index f86b56bf7833..bc51756a3317 100644 >> --- a/include/scsi/libsas.h >> +++ b/include/scsi/libsas.h >> @@ -644,6 +644,28 @@ static inline bool sas_is_internal_abort(struct sas_task *task) >> return task->task_proto == SAS_PROTOCOL_INTERNAL_ABORT; >> } >> >> +static inline struct request *sas_task_find_rq(struct sas_task *task) >> +{ >> + struct scsi_cmnd *scmd; >> + >> + if (!task || !task->uldd_task) >> + return NULL; >> + >> + if (task->task_proto & SAS_PROTOCOL_STP_ALL) { >> + struct ata_queued_cmd *qc; >> + >> + qc = task->uldd_task; > > I would change these 2 lines into a single line: > > struct ata_queued_cmd *qc = task->uldd_task; > > And no cast as suggested. > >> + scmd = qc->scsicmd; So do you prefer: scmd = ((struct ata_queued_cmd *)task->uldd_task)->scsicmd As Jason suggested? Thanks, John