From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E20BC04A95 for ; Wed, 28 Sep 2022 13:50:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233877AbiI1NuJ (ORCPT ); Wed, 28 Sep 2022 09:50:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229698AbiI1NuF (ORCPT ); Wed, 28 Sep 2022 09:50:05 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65BBD24BE9; Wed, 28 Sep 2022 06:50:01 -0700 (PDT) Received: from fraeml713-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4McyWd0Rg8z686wr; Wed, 28 Sep 2022 21:48:45 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml713-chm.china.huawei.com (10.206.15.32) 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 15:49:59 +0200 Received: from [10.126.175.219] (10.126.175.219) 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; Wed, 28 Sep 2022 14:49:58 +0100 Message-ID: Date: Wed, 28 Sep 2022 14:50:01 +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: Jason Yan , , , , CC: , , , , , , References: <1664368034-114991-1-git-send-email-john.garry@huawei.com> <1664368034-114991-2-git-send-email-john.garry@huawei.com> From: John Garry In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.126.175.219] X-ClientProxiedBy: lhrpeml100006.china.huawei.com (7.191.160.224) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/09/2022 14:13, Jason Yan wrote: >> +++ 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? > We could... > and >     scmd = ((struct ata_queued_cmd *)task->uldd_task)->scsicmd; ... but I am not really sure that this is much better, specifically because of the casting from void. If you feel really strongly about it I could. thanks, John