Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp599111rwb; Wed, 28 Sep 2022 06:55:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM58dISmGNsAezN63hltIa3tPWBUCS1hUWtoAn0n4Zivq8TuDIntahcI30IIkfLawJpPZrRv X-Received: by 2002:a05:6a00:2446:b0:528:5da9:cc7 with SMTP id d6-20020a056a00244600b005285da90cc7mr35558558pfj.51.1664373305456; Wed, 28 Sep 2022 06:55:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1664373305; cv=pass; d=google.com; s=arc-20160816; b=SUz9w47w5570SVHbEgPYJ/YEF4YSubCbV5ie+G/Q1o61NyE1FwXFW09rKTn6WHF2fF 8EEfn1Cy2lnGYNtZNAlfy2EIljYGy+ErEXCGZetRpCvI63EvqMmgKo++aZlhydBxyIch H0vdpvFOJcF52kTaTGKPwz3c5VzfcNgnZ+WGcUcJgXhpXbRMLjcbT2C1YOTnOMOhTFsY M21owW4M2+PCx0x7uMkwCfWNGA+0DK0fPN0IIcOL6G+CV8WkFqjyo02zQp6Uv8WEsbDX P27isxOfWP1Vb2JJ7XZnfzx55zt+ge3gKZCsTUJPq4NuXEk4qHV4I2Uep8zGs3Lz3S1z aiBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :wdcipoutbound:content-language:accept-language:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature:dkim-signature; bh=1aCVQXnTEw58iDSaRJUF0X3TMKqQKzFV2SYIh0n8AGI=; b=J+tae5BfINy9M5VurgpAk9sXeIRq861x3v8cuRjeMiBPpwKmdIy2eAjW3V9veu359p +Y/4Wb9jGxeBWbTUaCadaFacKk+nVogYSDyBRHT6RWdTVxjoSX1jpu9/ttFvXy731Efj 1UZpEYTjud6ejdFjCBdoL39vhl0u84EMXitAN+zqxel2GTh1vw7NHuQgu/1u7PzcQJad 1hKcLr43jV16MwUVPAV7XUgcve5enoJy5HrqWQoFbymA/CYjASIS4KmnCYpOoOVg79hS mvoxOKAtATrvnRFv1TNRQs90PN8fBzmN+Dx9VIEMS3D6ccPeNfFnwhVA/S+osmcThjWa PlUw== ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=ELsFM0BY; dkim=pass header.i=@sharedspace.onmicrosoft.com header.s=selector2-sharedspace-onmicrosoft-com header.b=y9yPCpoN; arc=pass (i=1 spf=pass spfdomain=wdc.com dkim=pass dkdomain=wdc.com dmarc=pass fromdomain=wdc.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=wdc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v35-20020a631523000000b0043c24d2c0dasi5857256pgl.141.2022.09.28.06.54.54; Wed, 28 Sep 2022 06:55:05 -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; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=ELsFM0BY; dkim=pass header.i=@sharedspace.onmicrosoft.com header.s=selector2-sharedspace-onmicrosoft-com header.b=y9yPCpoN; arc=pass (i=1 spf=pass spfdomain=wdc.com dkim=pass dkdomain=wdc.com dmarc=pass fromdomain=wdc.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=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233900AbiI1NRl (ORCPT + 99 others); Wed, 28 Sep 2022 09:17:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233455AbiI1NRi (ORCPT ); Wed, 28 Sep 2022 09:17:38 -0400 Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A2BB7391D; Wed, 28 Sep 2022 06:17:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1664371056; x=1695907056; h=from:to:cc:subject:date:message-id:references: content-transfer-encoding:mime-version; bh=TqqRxorbrrXPyzEErTjmB+PhKQymZUKomze1VCzLHrU=; b=ELsFM0BYgUr9kvV+9TuFoxe/RH/d/BgWsyGCGU7+SZCmVVwcHx4yLtLE 1vzKXqea/8m6Kpq0ze/UywND5VlgtT0A5tY8KfRQ74tSl17x4DccL5OBm W5ClW1vZe19HGlB+8p1ioEtwigJZBS+WNc4hGMMRDIczxhv/vU01QuJVm 9mAPSTWDSMrqIkSBVRto7Yhv7BPk8NCZ2m7lMtKSO776OGWvKb2Y5kSt1 mv8n89JTgV1yLGPI7TSu8WhnIAmsyuG6pMM4haMS74zpnde/bxilSvNkM T315LcJl9kNGH8j4jxaZXWfIiu48rj5SPHdUYecUtCc3J9B+n3Nws4Jt9 A==; X-IronPort-AV: E=Sophos;i="5.93,352,1654531200"; d="scan'208";a="212491779" Received: from mail-bn8nam04lp2045.outbound.protection.outlook.com (HELO NAM04-BN8-obe.outbound.protection.outlook.com) ([104.47.74.45]) by ob1.hgst.iphmx.com with ESMTP; 28 Sep 2022 21:17:34 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V1Wx01We9fN1+tv5oCbIALtseewMm+SZa5L6fup/zDUQoFIw5E38o3VXCF3IIJTScq76MeocwE5J7A0Rjso7FU1CKT6gnQS32ecPai/PUmAzeD8t/8w7rGLFOWCBbor4YArp5ZC4pCGGGiQwpUCUszUszNEhPEMFxu74vWGZNdyfeZZFvPGX04yhqFLbJOnksd6Fmnh1L3FI0OpYzt3+6MLagvFNvDMQtMrb9DsVFlXkpu7Nl9A+hER5Ehl5yD8Uq+ySD5ap4GtLbrusGK4SNq+5En1Z2AiWUhHYXXye4YVCeCSS4uXMcKp9WcwtBglkVhOFflXj9sybK9qRoA3DLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1aCVQXnTEw58iDSaRJUF0X3TMKqQKzFV2SYIh0n8AGI=; b=UZqYt7tzAhGSCLczs2ErD0DHDFu3+RSDMgaU+oB/IPqIT33QCmykX0inA+Z8QLbaz/eCb3bZcboBHnm5L3gIFyVMca5/XDjDSCAr9z8ZnILedmHGbLyO2UhRI/yN3fqdsuF+ckkQFSi5kSAmwKHVtKxiRFXI+57EhUc2XtusRIJQ1Jb3jy1LDg2YKAVtmmIZBO57dSiIRQNRg8S2r0SzWYJzW3PQ21rkiS2jmRoU8FpYf26gydCi4BWyv2b2lzAaJV0HP+omJl6Ia8jMw36nLM4OY67CryDO0VOhS0FZZBgs244+HUUL26a9QFrTsfGY8wcVpte3m0r8Y/m6TKkhOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1aCVQXnTEw58iDSaRJUF0X3TMKqQKzFV2SYIh0n8AGI=; b=y9yPCpoNO9n5kNsQAwyIVvvEP9Yqs4fr/abnFuYAlKhqsMXdU++F8KialiNyJttVox017hL0qrfYiSAWIYtR3eLzaxMjAEVew7rvGSnL7yQ2M6vMeCH4YC/usL41Zs6E6xmftvL7wp8RDwjTroXmYNMFwFeXuGJcoVimMDjc8Sc= Received: from PH0PR04MB7416.namprd04.prod.outlook.com (2603:10b6:510:12::17) by MN2PR04MB5711.namprd04.prod.outlook.com (2603:10b6:208:a4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20; Wed, 28 Sep 2022 13:17:31 +0000 Received: from PH0PR04MB7416.namprd04.prod.outlook.com ([fe80::bc05:f34a:403b:745c]) by PH0PR04MB7416.namprd04.prod.outlook.com ([fe80::bc05:f34a:403b:745c%8]) with mapi id 15.20.5676.017; Wed, 28 Sep 2022 13:17:31 +0000 From: Johannes Thumshirn To: John Garry , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "jinpu.wang@cloud.ionos.com" , Damien Le Moal CC: "hare@suse.de" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linuxarm@huawei.com" , "ipylypiv@google.com" , "changyuanl@google.com" , "hch@lst.de" Subject: Re: [PATCH 1/6] scsi: libsas: Add sas_task_find_rq() Thread-Topic: [PATCH 1/6] scsi: libsas: Add sas_task_find_rq() Thread-Index: AQHY0zapIGo+Met9mEGqTMQhhuqFnw== Date: Wed, 28 Sep 2022 13:17:31 +0000 Message-ID: References: <1664368034-114991-1-git-send-email-john.garry@huawei.com> <1664368034-114991-2-git-send-email-john.garry@huawei.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wdc.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH0PR04MB7416:EE_|MN2PR04MB5711:EE_ x-ms-office365-filtering-correlation-id: 3e50e74c-67c5-4790-7a35-08daa153ccb1 wdcipoutbound: EOP-TRUE x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: GQY7HUp88/s3+2EYcDknP4yFW3RfNWRRMRhEVc+ot6LSr5p5zUJmQ7WJZrSMtIACkIRS/C13slYxYGPKbGZWzbQQOOoy+7OB3QOvQZIde9Ojzyl9WqJYRKl3J/tgvxFb8yX0JvjYBUujB6EX+IXF8/DznvV1FBY4JTxP83bnUNbO0fwJ81oQh+/hMMHuGDnmQS71RXZTvH4uj+Ytp1IiAdGJ5mC+sDRDmhmfVa1QNtd/SIHmDUJpF1oTW1pf5Gt9q3m8gN3DeiNKPeB0x5fFmUe/oo39tgNaoElrZSu5qs079MA0Nqv2GJTnKVGgkQfTQjksAPIJxFLX+LbHyMCbtfZMHsYdBBDTgw4AZ/I+eBJyghilf2FOsPuxA+wiGskwRyp+JrapKb5H5lr0pMdVQl2l/oileA55TM1W/hBE1gESV4w3aAfWchUV0dYJubUxukphi5t0CZquApbM9oEWneMpd1c/Cl3rO0fqx0+Y723uctETDCm5lAnmA7sHlBBVohr1aJE/kYa38u590mcs3n5M507DocGkdH2tHvpuo0TFxnaV8lO/R9fSYTcLtz2Jm86tu3BfbRanm9Oc1Pv9TzMmj4Bthwx+kteUbYmF3YmYPWu7LBx1Ps7myx7TN9BIkVS/3/lYKdeAMDqGx3Rjdc9PBH70L6rtlYKuI+5t1I0B8EtzggmXv/I79vVN9jQSJNODV1LZus2PNgI+mVH4LoYhDGR7l6wIgQRGXS06pkVbg5gPaotlszDqye3Xwb68FY5dLz6NMReKCpyxG5drPw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR04MB7416.namprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(136003)(396003)(346002)(376002)(39860400002)(451199015)(83380400001)(71200400001)(38100700002)(110136005)(54906003)(4326008)(66556008)(33656002)(64756008)(66946007)(66446008)(8676002)(316002)(7416002)(76116006)(122000001)(53546011)(478600001)(91956017)(66476007)(186003)(55016003)(41300700001)(5660300002)(82960400001)(2906002)(8936002)(86362001)(6636002)(6506007)(52536014)(38070700005)(7696005)(9686003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Z/4ntsQOGCJ9rrUKXzvLM6X9pCjdovXlndRGylt1kYY57t+20MLYbsl1tYMe?= =?us-ascii?Q?CdfbcRSqO5aotPn3izOclr8cCoeTWAGylxffupi1NHgFUHTxqB/PhepH0Ijv?= =?us-ascii?Q?VLHG7yudCHkJPfEVHSt9kVpTSaWPX7wz9XfCdX6oRCRsxmfou1fK3OGx7+Gm?= =?us-ascii?Q?XATDSepG6h6t2gDznJpHSkefPVl7vA5BJQcf6G9Cp/coMLf6AGWEGoyKhhC0?= =?us-ascii?Q?P6UAFkg2MYeAtBois7atJ2cPvC/6PKv+QpXoR6nJsOauJlRltHIX+1FDSwVS?= =?us-ascii?Q?kiEfHQvc1nSVgd8fItkpkJoazdA1A+rJ4rajlfltOcNown8WKnkjDcwJLVdK?= =?us-ascii?Q?xDxNa8/F8rxdyrQ4dgJj1UYl8c82QXVSf5ny3eA1i4hyMANSCL+/r6V7NrT6?= =?us-ascii?Q?QI+kD3ByqTqbn+1Oh2l64GpqKbE82p7xAJdLc0zkyuGNpE/ZvtLwXWenLjJV?= =?us-ascii?Q?83LXDHT8Fp9xttobsEtPHIYrr4pdZvdLCeG3RI0Kk3hcqePKqKOpaXeIcWbv?= =?us-ascii?Q?QaVcn8VSwRn27QAa/H04053xOP+HOORvP2sULutHTB/8Ho58P+Ss3Hs5PlZb?= =?us-ascii?Q?FitRyqiv+yOGfhnhREpzVkl3viJsxaxtGDnFaPx5TipSQ1BcBMoymej9tvpt?= =?us-ascii?Q?aKx4pmNY014sa0m62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= =?us-ascii?Q?rqOtjc1/R+N1jYgxDScsF5R5ARpWE7jm4ijtTda4cK4oRgMrDRh7/1AQ9Mzn?= =?us-ascii?Q?yio5VSVb7tA4KQLwxpLbDMebaPTZ0izhcYIGXhAFcAkK0iipv0rtSc+f1/15?= =?us-ascii?Q?2bSPwCNW+3wupfNneozfIg1J8aI=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR04MB7416.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e50e74c-67c5-4790-7a35-08daa153ccb1 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Sep 2022 13:17:31.4574 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 1GrbS6TEh7IuO0REs5kVhG4e4MCCO2zdba3tidrrAzUH8aGGjr1dgIWkqYmD3bEEwzfsQEUv8jjRj4hFiQQp9sF+v0y5O4cqu1ZdN+NYeJU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB5711 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_NONE 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.22 14:34, John Garry wrote:=0A= > blk-mq already provides a unique tag per request. Some libsas LLDDs - lik= e=0A= > hisi_sas - already use this tag as the unique per-IO HW tag.=0A= > =0A= > Add a common function to provide the request associated with a sas_task= =0A= > for all libsas LLDDs.=0A= > =0A= > Signed-off-by: John Garry =0A= > ---=0A= > include/scsi/libsas.h | 22 ++++++++++++++++++++++=0A= > 1 file changed, 22 insertions(+)=0A= > =0A= > diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h=0A= > index f86b56bf7833..bc51756a3317 100644=0A= > --- a/include/scsi/libsas.h=0A= > +++ b/include/scsi/libsas.h=0A= > @@ -644,6 +644,28 @@ static inline bool sas_is_internal_abort(struct sas_= task *task)=0A= > return task->task_proto =3D=3D SAS_PROTOCOL_INTERNAL_ABORT;=0A= > }=0A= > =0A= > +static inline struct request *sas_task_find_rq(struct sas_task *task)=0A= > +{=0A= > + struct scsi_cmnd *scmd;=0A= > +=0A= > + if (!task || !task->uldd_task)=0A= > + return NULL;=0A= =0A= Is anyone actually calling sas_task_find_rq with a NULL task?=0A= That doesn't make a lot of sense from an API POV for me, having=0A= the only argument allowed to be NULL (and not being a *free()=0A= kind of function).=0A= =0A= > +=0A= > + if (task->task_proto & SAS_PROTOCOL_STP_ALL) {=0A= > + struct ata_queued_cmd *qc;=0A= > +=0A= > + qc =3D task->uldd_task;=0A= > + scmd =3D qc->scsicmd;=0A= > + } else {=0A= > + scmd =3D task->uldd_task;=0A= > + }=0A= > +=0A= > + if (!scmd)=0A= > + return NULL;=0A= > +=0A= > + return scsi_cmd_to_rq(scmd);=0A= > +}=0A= > +=0A= > struct sas_domain_function_template {=0A= > /* The class calls these to notify the LLDD of an event. */=0A= > void (*lldd_port_formed)(struct asd_sas_phy *);=0A= =0A=