Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp585702rwb; Wed, 28 Sep 2022 06:43:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5sxLchMVIuzKSIqYAJE+MsrcJ/2fkprXBfJt2lc2s2Xtqqqa/kUgr4Hw7b7obwf6p/yToq X-Received: by 2002:a17:903:18d:b0:178:28d1:4a13 with SMTP id z13-20020a170903018d00b0017828d14a13mr32434626plg.160.1664372614146; Wed, 28 Sep 2022 06:43:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664372614; cv=none; d=google.com; s=arc-20160816; b=VWKl6diUKUg+e+Nel4XfLGnqbpZizvEt+X2D+1ijKuqw86trcQ7kPM061ldyNfAyGb TMUzKP9TQ3muPBMKDf/dLRBDYhmJ5DxgkjBwo7kl9O6OuzE1Y4sWUon9shSfig9QWymB PpfGUnIoN2iHK+smLdm7qIfHN0az9DfEvuGw1HemYA4WbQ19ORYftXpzYuVswJ1prfM4 1fAPyESKe66kDMsKlo49nL0jZF4mlvZs9KxjHKy/6+03DU6V8vTWipzjf336wQULDPJ0 GeuxTp377jlk8C9N3d8dP7GfsJIzZVLqbePjfml9bkoySSgRPMOv1gfQQlN/um0Uyp1s +hng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=y3LgYznK8pZp24Uk+/GzPyYCJj6+0rja6U5zU+TVyl4=; b=OlmqJREUBGP7udtNxGOHeoRRf/NCc0V9vx2GrM37TkpEjCgk9Cc6A+fzHBGr18y+VG TG09oUq7r8kjgXhivkGCX+Ol1ghTGOmOKi2gCtuNPs7CUVkB/vVif7qO8tQ3G6aazOCa XzyhqSybPnA68IinP3JL5oPPHkeETTJ1ODqFg1V2hSG8entP2nq1oMXLPgqxJzQG8M+G giPGCGUlyoRQvY1B0kzQpPGwAkEOAWLuvOHY2wq02HUPsGYJtaB+IXjkcKH3ODGqHWnG jZwqUzVP7yn/lRoaf56iHyMunBIYS8YqL7nu56qdG+2PXJjPKow+MIJCnKYR91epud5h DwNg== 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 g1-20020a17090a290100b00202df748eefsi775699pjd.159.2022.09.28.06.43.21; Wed, 28 Sep 2022 06:43:34 -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 S234028AbiI1NOI (ORCPT + 99 others); Wed, 28 Sep 2022 09:14:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229951AbiI1NOE (ORCPT ); Wed, 28 Sep 2022 09:14:04 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14A429C222; Wed, 28 Sep 2022 06:14:02 -0700 (PDT) Received: from canpemm500004.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Mcxhv5hnTzHptq; Wed, 28 Sep 2022 21:11:43 +0800 (CST) Received: from [10.174.179.14] (10.174.179.14) by canpemm500004.china.huawei.com (7.192.104.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 28 Sep 2022 21:14:00 +0800 Subject: Re: [PATCH 1/6] scsi: libsas: Add sas_task_find_rq() To: John Garry , , , , CC: , , , , , , References: <1664368034-114991-1-git-send-email-john.garry@huawei.com> <1664368034-114991-2-git-send-email-john.garry@huawei.com> From: Jason Yan Message-ID: Date: Wed, 28 Sep 2022 21:13:59 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <1664368034-114991-2-git-send-email-john.garry@huawei.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.14] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500004.china.huawei.com (7.192.104.92) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,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 2022/9/28 20: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; > + scmd = qc->scsicmd; Can we remove that local qc? and scmd = ((struct ata_queued_cmd *)task->uldd_task)->scsicmd; Thanks, Jason > + } else { > + scmd = task->uldd_task; > + } > + > + if (!scmd) > + return NULL; > + > + return scsi_cmd_to_rq(scmd); > +} > + > struct sas_domain_function_template { > /* The class calls these to notify the LLDD of an event. */ > void (*lldd_port_formed)(struct asd_sas_phy *); >