Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp711993rwb; Wed, 28 Sep 2022 08:11:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6XDhdRqI9esN80dfcQAwPy2Y2PBEFwbmVLG9V6g9dXwM9rnd03Ec80YO7xL+XOiVsUhKPY X-Received: by 2002:a63:5511:0:b0:439:12f6:fb9a with SMTP id j17-20020a635511000000b0043912f6fb9amr30801315pgb.197.1664377898683; Wed, 28 Sep 2022 08:11:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664377898; cv=none; d=google.com; s=arc-20160816; b=e23nJfwWfPw6r1G/53A8ozDERHr5AuwvuXwzqI+xUojykHdx08qiPNvNNU0SdGu0Ee NGwb9ndw4E7cY8oF5Wjw2yZ55P49NSIglo7GoGiE004KWylsqC5MUjdoYG3fmZWe9SPD xZz9XwQut2rzKNrqV3YulKkHAOGnad18/ucB9X1Nt4uzBwEa8B/6L7zu7vRwPllzU8pA iKU35CV3Jg4gf/3BPTQVQO2uMofevEEIFSGPx3JrNpvRErdo6uPNXodNm2sffgSMuylh eITYBULO+4SpGKavbnTziV5g7WsR5ZLbtGriRtwGqV5RtbPP4C+pX0hqYSRvYuRgM1MW HomQ== 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=O1b3OEHNaFJMY6iwBWXs7fwGUr5iCu+VOrPjsmZhaFA=; b=OOmd/zbSO2IDgkc7NgtG3D7h3us3dMcbJxhXLZeR3Eu7jknK2P5MS+C46+fghasb4v 3v25Xp14QuieX1XoJZPxkE6oGUTtZ9Qk3VMovb5r1qPYY/KWl3HbjTGJbKWEsPqYJwxY 7im8s+flW9WBE+3S/rTVGRcVNXYfxC06gS/hdFgJ1JhhSJZzENREVvrEIw4IXvRB5YVz PhSpUBMtXsp5TurOO/UMoyfABv9glqJbXqZHn5xsWOnEzVsGzn+HzvvtpUtG06WtSbTe 9V/aZHr8La4xkXlwo+i/BzV+SaYkXN/XHD5p55CeYrOf77IQIaiyS+WEWTohyRdPTrjK xe2A== 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 mh11-20020a17090b4acb00b001facd1e581dsi2935851pjb.14.2022.09.28.08.11.24; Wed, 28 Sep 2022 08:11:38 -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 S234060AbiI1NuI (ORCPT + 99 others); Wed, 28 Sep 2022 09:50:08 -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 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 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