Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp688090rwb; Wed, 28 Sep 2022 07:57:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5n00YHQhtSQTo3mr+7/6t4ufcDSuABpvpSajux0p32H8PYL/jerBQVnM3Ldr6cUecrk5aB X-Received: by 2002:a17:907:7f27:b0:782:7553:9653 with SMTP id qf39-20020a1709077f2700b0078275539653mr25667493ejc.390.1664377043296; Wed, 28 Sep 2022 07:57:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664377043; cv=none; d=google.com; s=arc-20160816; b=g36fegbfEOof/ScTCNA+cCAQRWUyzRX2iQJWHN4GN75oalaMWpB7OeJPOf6gJOlg5S Nax2SQFPEDZWeK95rsXCLA6+EtDWQhkg1XvzvjFzpC2+TrAggM5vg+r+cPcsE0o56PgQ lNKPMuXJBXVzQ0A0hLfry64Qt9X9Mfj4+ZIhg/4TZlK188S9zHNaXxpK02Es45zX1SNs 8BNZjxqFsHyyOLbSqGX4dr41Bp2mQyGMbqfjPigtEC5WeWr3sv5ITNhqO4qvObHljTL+ 3pib8+FGVqjnMVx7Xndtm2BCFnUEU17X5LLLAo1cILztYp84bjMJBN3XIK0SA+Tox7Uk OJxw== 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=aWonKlFZbP2eY7c7PtHBVl3JK155telUZfdi2uM1Uww=; b=gPAFmMO3pgORFEXUShsNlBfwsSBPm0vFw1+BoDAwy4sM1wi5mjSz9Ubri+XpardQ12 GHzY/xWkAA28DL5H2DZCLvJ3ApcxNvzk0x3XCcwYP/Nei4k8OFZpvhBVqMi23NAiz+rZ mLMlSFwJlaf99c2jOVF/pFOazee4s6pp5jGXS6XIEzCN53ZoHZjWR9Ck3Mk8qv+EE+8a Sva8vluPJhvYtNN4yeVxeKAPFMt0vUKOfLNDADFUsRh7blHUsTCOoFEb9jQT2MUSUS5W AtDi+9yRRNI7NbgkmYYgdArUAqLkP6XvzIpcFv5liFyfSzwI+wgoeu86X+D06/z+hODC /WWQ== 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 y18-20020a056402441200b00456e1b5b8e1si6802239eda.426.2022.09.28.07.56.57; Wed, 28 Sep 2022 07:57:23 -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 S234449AbiI1OjO (ORCPT + 99 others); Wed, 28 Sep 2022 10:39:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234427AbiI1OjL (ORCPT ); Wed, 28 Sep 2022 10:39:11 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56CBAAF0F2; Wed, 28 Sep 2022 07:39:04 -0700 (PDT) Received: from canpemm500004.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MczZD1g41zpV9G; Wed, 28 Sep 2022 22:36:04 +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 22:38:59 +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 22:38: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: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.179.14] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) 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 21:50, John Garry wrote: > 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. > There are plenty of examples in the kernel, and in scsi itself. Such as #define fc_host_node_name(x) \ (((struct fc_host_attrs *)(x)->shost_data)->node_name) > thanks, > John > .