From patchwork Wed Dec 1 14:28:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 519590 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 0CE27C433EF for ; Wed, 1 Dec 2021 14:29:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349890AbhLAOcU (ORCPT ); Wed, 1 Dec 2021 09:32:20 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:3588 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349860AbhLAOb6 (ORCPT ); Wed, 1 Dec 2021 09:31:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1638368917; x=1669904917; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=JZuqMzJ+Qg180bNPY8BxMlhDGNRleISKsfmsBCRUwW4=; b=laZDImdPzTsECSrVqN8oPSsXbb4uu9aCbfgNbVT0iQKvwExpV69wP500 Qv8edq0pvGwtXU1oHqnqAEi2k/n/YLNW9WUbNsOKiwSBXLGn09gw88iSp rj7yRGEghBJtTyvEuQzQluPVsjNvKCH4fTYysLWmWm8LNk+7ut6VSz2I3 WsIJFbMULXyU5rcJLbinbZsqEP94YHw8oRxDUZCIc510jOH9uESKxsfBT CpmDFEOWII8alddrpUQjJlyolqs4l9aIvjqqegqaXEaisViqk8EhBCkoe gQtFo9BqT1D1CdKRBQf76GFfudcQjPzlVBwRMKZLrEOdxXMPCul1upyGG w==; X-IronPort-AV: E=Sophos;i="5.87,278,1631548800"; d="scan'208";a="191972077" Received: from mail-co1nam11lp2176.outbound.protection.outlook.com (HELO NAM11-CO1-obe.outbound.protection.outlook.com) ([104.47.56.176]) by ob1.hgst.iphmx.com with ESMTP; 01 Dec 2021 22:28:31 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gJ7CM6oxm75dqoRCJpI4nUB/or3jKnz+RXxByDQMsprUGSBSc5R5WIhCVXomOG5g6mAIfFk+sndOkvKsMYiNqo/TR2HfkoAofDgzfdCtBC25ZR0hj8mVmTD2AfpzC24pTqmLH6TztQfpGzvCD8zIqTP3L9wClN8DyvcbOLxLbTGBz5//9G9j4MEAb6zVHgsez4E7YGQ+v9Fvr3eS+b8X/HfQiWVvJhR2nbUXIdGyhOc4X2iIkW8+VorArl3i+gSwZEQWd9t1vJZUyZNtO/c+Ya7xTMx2BsUinJGwRkN6GAag4UCNKFqrOXDPn6GLSYSafmTOR2gs5XpGCNRz4Ffvmw== 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=/l1Sk1wUnOqmlmQzFgz/awJi17KFY6ua8lGDY3rhxjE=; b=G3aYIqq7LShtfGzR54QcdPQc2x3oyBq4kTNPg1gaspcxlKOSC++rRjeQpeP77NpolgezOB1e3G29Ub1miElHC1+44puBAu4abe8EMIQj4uaRRwofXj7CcqXrsL3MffPEb/BTfAyxnlRkNBJnXNXN4K56EHt8sYf0jr5tVB88EzVmrHoKVcPmivb/2LvTGSKKcCcNhkjj0lqRW+tXCGbvDf/4p583GslLiKnAgbyLVDsGTjP/LHcDiBtkqYMmnvQIlqAI1rmPkrYrrZSaGjqAsAW0KHdHn4g8BDD9pCGvgc26/zopVX+5z/SukNOLWPq4Kx/o0OIcXeEuIYKSP8Ck/Q== 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=/l1Sk1wUnOqmlmQzFgz/awJi17KFY6ua8lGDY3rhxjE=; b=khG6DyjkU5gbBgfSLiXwQ1YnxWjPB/leED5ct3Tgk4iN2Ovml7D07aNeYk69Ml2bwVtyW3Q7CnPxUiT4J8rXe3y1JDQqFGRmo9nkTPvXron47QzbF6w+o6E+NDde3bCgaBqePHx18UDCEwSCMJT2l8eKPPBLQm+qfFoseF1e5Jg= Received: from PH0PR04MB7158.namprd04.prod.outlook.com (2603:10b6:510:8::18) by PH0PR04MB7576.namprd04.prod.outlook.com (2603:10b6:510:4e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.11; Wed, 1 Dec 2021 14:28:31 +0000 Received: from PH0PR04MB7158.namprd04.prod.outlook.com ([fe80::c504:3d44:5aef:f3ca]) by PH0PR04MB7158.namprd04.prod.outlook.com ([fe80::c504:3d44:5aef:f3ca%4]) with mapi id 15.20.4755.011; Wed, 1 Dec 2021 14:28:30 +0000 From: Niklas Cassel To: "James E.J. Bottomley" , "Martin K. Petersen" CC: "damien.lemoal@opensource.wdc.com" , Niklas Cassel , "linux-scsi@vger.kernel.org" Subject: [PATCH v3 1/2] scsi: sd_zbc: Simplify zone full condition check Thread-Topic: [PATCH v3 1/2] scsi: sd_zbc: Simplify zone full condition check Thread-Index: AQHX5r+2diDciWhRHkSViLgVDTPYbg== Date: Wed, 1 Dec 2021 14:28:30 +0000 Message-ID: <20211201142821.64650-1-Niklas.Cassel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.33.1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wdc.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bd6d5f99-a72e-4dc8-0450-08d9b4d6d933 x-ms-traffictypediagnostic: PH0PR04MB7576: x-microsoft-antispam-prvs: wdcipoutbound: EOP-TRUE x-ms-oob-tlc-oobclassifiers: OLM:7219; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ag26zYz0h3VvtwOhF8dOGB/mz5LGJKWujkRUH8oelS7f2DK6B7e45W3d8xjdc51TO2nmlERrLkxzHdlkmRPHwtwCiI10dSa24h0241IoZd28dUPsKxeF6jweqUqAlqqjnvDMrJ7BHGJRfiR+E1gKrbnH8zYszIbWKAgX3KKIjo0EG5dA/X54VZnjvIUlu/eTDE7N9cpevCNart+JWEZuwDgxr7H4uzRU/hhGabBJCP+xCj/Qw8+b0uecZRlQ983ofkFqjNnX5m/rGeFg/5z49RyoJk9QyaE8kmBAEAGqrdL9xFoyOWVm7/986hKgisOEo1wmbYmv896EEQabQH7BhAeupoTC8/t+1n11CzvdKq5iJMcIwsFeUi6mRVgrTi76c9AqvvNjeL9WT+Aj0vNC0Gv4xYg3fuSd75U4q2dq58tS6NH9O6qG6f3M6SRnWDlxDDrsUEkO55hwIQHf8BLiC2/hwX6k6ViEI+jfpnfN5KZm6eF2/3BIonhdSNmIvlC2fYSZ8V3nctrlAwJzQtVXhtDPZ64P/ew3yBVDrh9tOT8qEQynk0cV1UBtOOlbI6zBqFKn3BFeWQxBcIiyWRV8rqBg/RHBitm6H4QHUWFtKOGxlx0XGGt1jJH8pta1iqklrs03RTn5VsOc9Jhw10U+7PsQGKMlCPD3V7yddsM2u4ORHyZ8+mHh66NBpvNERWdpg72V7sMxgBaqXOMe4N9+pw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR04MB7158.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(122000001)(4326008)(86362001)(110136005)(5660300002)(186003)(71200400001)(8936002)(316002)(8676002)(66446008)(2616005)(64756008)(54906003)(66476007)(66556008)(2906002)(76116006)(508600001)(26005)(91956017)(66946007)(6512007)(36756003)(6506007)(82960400001)(83380400001)(38070700005)(6486002)(38100700002)(1076003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?/lIrLW0AS7YVsSTz6cqMNcW?= =?iso-8859-1?q?m+L/UwJTVGtdxcHpRO5LKdfCGYj8EPqk2Ou+RCGKHLyT6h3OMMCZkcVftSST?= =?iso-8859-1?q?BpGN3imrBS7V7lZcWuSgWLzshd9jd4fyJIzGho9dWX8Us5QEz7mzrZX3HyV3?= =?iso-8859-1?q?T6LmeiW4kcsby7RTuy6lnUHlIO6JmEyqOtOAc8HBZ63Zi3ckTR82amTHYg5t?= =?iso-8859-1?q?FIucBpBdGNAQT2W/jssZNbcDNRW2gyaoUowmORc3HBKmPlDdcjL6j5ePxAxy?= =?iso-8859-1?q?0JLD1i/KuHo2sMauv/EpaSjt3AQy6l5N1iGQhDsf4t9hJkHSg+xLp+oA1LTp?= =?iso-8859-1?q?h27qM/SLh53odfiNsTIRxPoWKlhzvdeO9CgqshuX9VBc+S3uwHpcE6jaHHPs?= =?iso-8859-1?q?uLdsLwBWavmRamha1KqY9qVPmYYrZBc+59Vcb28Prjw7OffKwMODkuSD41ZC?= =?iso-8859-1?q?9FUvoxJp01VUU8ymLLVFUZFXqhY88nQenY20v7xwY2S+QS0+s5jfpeG6dHjy?= =?iso-8859-1?q?Hm2g7L4Yyp9A+wfGntWf2A3NIdd/GfS7SJYEjwtADb22SJFKhDyjX1hOojAs?= =?iso-8859-1?q?4APpjRINAFEFgYSb6hjwwv2SFFm9+rwgCkWvJoi3NZFWwcBg9GYTTWg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/2FeEyqX331gQ7Ttxo31QdH6dRnPNrbj2pqO7muDpbPyEislsYnshS93Q3?= =?iso-8859-1?q?NigbWRmgXyh53Tz8TE1d/L6FTh9RnpjzB5LAvhqKSTgntvaKXziM24sWsUH5?= =?iso-8859-1?q?Iq6PY3aKQevGNmTcSWgSnvKL03s+fCar+ITOD1FtZChEdcZ3XuouZ3zrPN6Y?= =?iso-8859-1?q?wihQqbqK/ugEYiOt2b4L0?= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR04MB7158.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd6d5f99-a72e-4dc8-0450-08d9b4d6d933 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Dec 2021 14:28:30.8202 (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: 0viO6LrCdWrUsYA5gp9q+TwP8xlI/i9c85aTGQRrtqbUtPdBKwBLSA5ogbQf5PdXA31iERgf3OeoWnv2BzLvlw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR04MB7576 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Niklas Cassel According to the ZBC (and ZAC) specification, a zone that has Zone Type set to Conventional, must also have its Zone Condition set to "Not Write Pointer". Therefore, a conventional zone will never have Zone Condition set to "Full", which means that we can omit the non-conventional prerequisite from the zone full condition check. Suggested-by: Damien Le Moal Signed-off-by: Niklas Cassel Reviewed-by: Damien Le Moal Reviewed-by: Johannes Thumshirn --- Changes since v2: - New patch in series, as suggested by Damien. drivers/scsi/sd_zbc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index ed06798983f8..749c5e5a70c7 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -62,8 +62,7 @@ static int sd_zbc_parse_report(struct scsi_disk *sdkp, u8 *buf, zone.capacity = zone.len; zone.start = logical_to_sectors(sdp, get_unaligned_be64(&buf[16])); zone.wp = logical_to_sectors(sdp, get_unaligned_be64(&buf[24])); - if (zone.type != ZBC_ZONE_TYPE_CONV && - zone.cond == ZBC_ZONE_COND_FULL) + if (zone.cond == ZBC_ZONE_COND_FULL) zone.wp = zone.start + zone.len; ret = cb(&zone, idx, data); From patchwork Wed Dec 1 14:28:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 520129 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 EC87EC433FE for ; Wed, 1 Dec 2021 14:29:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349894AbhLAOcV (ORCPT ); Wed, 1 Dec 2021 09:32:21 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:3588 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239486AbhLAOcT (ORCPT ); Wed, 1 Dec 2021 09:32:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1638368938; x=1669904938; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=/YtbEjRqt8pwcx3j2btCvVoYzUhUwnUvmjj+uA+znKA=; b=Ew44jEizZ78vaCEmvns9qMtsIn/9BTeMYA+RN+2KiRFa9kpMkGT8nkJf Ft3wuWwTeQAcWbqKGypdG9Pm0u7ownAPIQ3kaM9re5cUpSVyfXDFGVV53 nBLlAOeRmPcbcHESkhk1h3DJnKGL9oV7IivCx8f27dTkKlOKWUNfJHzYL rpmOVn1uUpLAm0lx5HpVslMJVCZLUuC4eHFYq9rCfewdWh/RB+3uXAHCO RCu+Bl0JFwiQ5FkfC17i/HVSoD9UTdTTM04CqKlKjGUipfZM+QG+A9VUY JWqBAiTxb1M3vNMA/oyylCrrTzpmgWL3/760uYaXkhr/09GfJwHLWyUg3 Q==; X-IronPort-AV: E=Sophos;i="5.87,278,1631548800"; d="scan'208";a="191972081" Received: from mail-co1nam11lp2171.outbound.protection.outlook.com (HELO NAM11-CO1-obe.outbound.protection.outlook.com) ([104.47.56.171]) by ob1.hgst.iphmx.com with ESMTP; 01 Dec 2021 22:28:32 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WDMrBFImyxp4XMEnGTWkEyBBxYCpPThqSF14U1AchoqZfLHXGGvc7E0IDVZkGrlQCyFbO513SiCbPhbMtEqhQ/Y3850AIvIfIsazoVVlUkcFCCbHYXO7h6unIC39ZiRl0bq5jJBf1he95YkHlIxGBKFSK3aB/rdWT0Ykhmh/Z+L9MzTF8x+m3/zM5l+BMr0HIz9Pc/LEegQXwyTJpNBfp3wIY8SX0NGChlSWnk57rPdvm2qyvfO3glqS0BWOMTtjDK5UXxR+PBzxl7H3DBkCBihaE4gLVjOi0gjpKMDXamZ3DbNXoEdaN1ZMg8maZTYClcTaoHP6xPh/VuIyNN0G8Q== 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=+IzzvDErfNyHEUPll21SBrTxh4OeeZfTWnyj6aj45kk=; b=e0PgxGuxchHJjfBoTVuXois8vF2aOESfI+WwN315YXtL7bwHIWaYvjVB8/sYAhAg/OX14mUL/iQuHgBXwJyd86wO1Abe4BYuT9ZR0BxeEY+WEo4uBA8IA+R6L7QsqnJcSAwehgBQYJphQmu5fPzEVznqq+4Ww1AubF/7xGe68d7zQ2why4kulRHajF4jCpuAgPvv+TNfM1mPx7VKe/L+c6lmuWmuoviygEvQ7uVy24QdGPSMAn+tcEqbDkqeBGpAanaXkKKXaVu69Mx6/dlpdIAx7M3iqhXZVw6WxWw9AssPnX7aSl1nzosxchuNA2PrIngwi1S+/YqC4JHO8FiWfw== 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=+IzzvDErfNyHEUPll21SBrTxh4OeeZfTWnyj6aj45kk=; b=Q/1cHzWkpLeRwRE5YsSRBoebE/DUoENn0zrwxKU1+CmddtUW3kIFARZNHw1MxR2UA9tXDLgd/+Qx0gEYsjp3BD9whty/uvq5vjrzQNnBdVzyPHqg2qv7QLF9Aq1UIW0QYgOtuQzJVg7Z/3+93Fa8k7SltihQnHcYEL4MOpGGQlA= Received: from PH0PR04MB7158.namprd04.prod.outlook.com (2603:10b6:510:8::18) by PH0PR04MB7576.namprd04.prod.outlook.com (2603:10b6:510:4e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.11; Wed, 1 Dec 2021 14:28:31 +0000 Received: from PH0PR04MB7158.namprd04.prod.outlook.com ([fe80::c504:3d44:5aef:f3ca]) by PH0PR04MB7158.namprd04.prod.outlook.com ([fe80::c504:3d44:5aef:f3ca%4]) with mapi id 15.20.4755.011; Wed, 1 Dec 2021 14:28:31 +0000 From: Niklas Cassel To: "James E.J. Bottomley" , "Martin K. Petersen" CC: "damien.lemoal@opensource.wdc.com" , Niklas Cassel , Johannes Thumshirn , "linux-scsi@vger.kernel.org" Subject: [PATCH v3 2/2] scsi: sd_zbc: Clean up sd_zbc_parse_report() setting of wp Thread-Topic: [PATCH v3 2/2] scsi: sd_zbc: Clean up sd_zbc_parse_report() setting of wp Thread-Index: AQHX5r+3oiMInrqzYEelPeKwBr1i6w== Date: Wed, 1 Dec 2021 14:28:31 +0000 Message-ID: <20211201142821.64650-2-Niklas.Cassel@wdc.com> References: <20211201142821.64650-1-Niklas.Cassel@wdc.com> In-Reply-To: <20211201142821.64650-1-Niklas.Cassel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.33.1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wdc.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d0deeb98-e63f-4c09-4367-08d9b4d6d9bd x-ms-traffictypediagnostic: PH0PR04MB7576: x-microsoft-antispam-prvs: wdcipoutbound: EOP-TRUE x-ms-oob-tlc-oobclassifiers: OLM:1775; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: SKJqqhT++5c18VrFhsSyGR2twa91vHTTKOvP9INIWrCS4zyWjlEgVekfH2eIOwVU3MUu0CTMhuzzKbE7ueew+lWRKpL6Wgax8lnJ36ADqMdWmmbEFV0V/XMt/KRJLgt1CWflnwsde/3T0UkSktewcXHmE+PQjJGmOMPUcA3vB8A4aqlJJsrgDb4t1mk80oAzeVUYd1e8Bop99dBwkYsWA+alw04ZFl9ivxZd5YmqoGnZXLZy8mUfb4NUGzC5ZPX4YSQUgACHYQvJgvM9CLk15yUsRJ0AHCASWOsy+9PyEelmdASvA8RTePC/cXjwf5aW9RalE39F8/7ibT0+ND02bB0GQdSURlEYZ7f7Rg8K/n/rlbWXjuQUMfwx3Ir1CWa7hunJBFldRnIL+88lpg9yoo1Btd9TO61lVdeDNWI3/SU/FetF7ex6sSatrwz6s2sIcRZXtDXg1FEGRc2p3gRhh6vI4rsX9F41mu8rCVdasI+PcswlHNpc38CJuG77MFdQaN08mCoWW8DodVthMlCoGIQSZ5GIsrWZMn5KklEVXNfiJPlb+zLkD5cEyi/YdGowRj3UMPWsihFjcnapspv6ejVn+QGhxZqJByJVdpu4SRtINEcqgcalBEg/58OzupmBBFS6JndsvSom+LTkHOfhcBK6pNxaeGjK1sTtF6w8wp4ZI6Jh9Zg69OT24OPx825NZd+2yMcc/XIsqxfE7LinYg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR04MB7158.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(122000001)(4326008)(86362001)(110136005)(5660300002)(186003)(71200400001)(8936002)(316002)(8676002)(66446008)(2616005)(64756008)(54906003)(66476007)(66556008)(2906002)(76116006)(508600001)(26005)(91956017)(66946007)(6512007)(36756003)(6506007)(82960400001)(83380400001)(38070700005)(6486002)(38100700002)(1076003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?/3WP34ZNgj5WlYdhBF+wp5T?= =?iso-8859-1?q?k501g+7pdPxbHeOj7nx2d8xuCsS5Z89wrEKlRfGwtl7yuJi3d5NABkFKmI2l?= =?iso-8859-1?q?SDvyeoMCH6cxNec7Dy1+HR5zJhqwqq8L2ARHEj8dokGPq3m2AfMFmXad5Xro?= =?iso-8859-1?q?1rHDoJu7eil84KizmhjufpxQ939Zx/Vl3UI/6QuHTU2ISoTMuI7D+S2pb8kv?= =?iso-8859-1?q?Rja7iYhog75/YUohpgbhIPQ0CP9hPAOYo8/hUgrORbn8d9I8SmMQ44m5kl8q?= =?iso-8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aNuRTnhsr3OQEyuLLsDjARfZsyo+t8Zv9yiOmB5?= =?iso-8859-1?q?fBecDLXtPAxS68foE1iGQ6QIilSnfj2OHmYtXqN646u7YmnBJjXGMNdQIP7F?= =?iso-8859-1?q?BR5ujn/vPQmSNwYHkDLv3cQGN5fX2/ruLM2Z/hu34wiwMKvT3X33f3ypUgLQ?= =?iso-8859-1?q?2IrsmACC3LbSRsAl4/7K4wsNSIrth739Ut4ALuTT5GaPwoHhrqTxjk2THPHi?= =?iso-8859-1?q?6z4y0NNEVHTqQDA5EkLq5l0eyvqHyF32wOZXa/mSIg41qSk8EArHTABRYHqk?= =?iso-8859-1?q?OkB5vNqWZA4EjcxpiJdhVGq+4vC+xILNoh1HBoF6MdZaEZCejfO704Ay378S?= =?iso-8859-1?q?TcvCGNMAiTfC/bGGMRYeBlBTYWIe18YmpWgX/NqFBwsMG+5PSY34TqK1S83X?= =?iso-8859-1?q?6jB1bo7YZKvimsNiuUWvr3E6CYx/1LRuyZjVg25gAZGQsANlzSCqO1196Afi?= =?iso-8859-1?q?LNtoDoQVggSzwTo5IyimUXKeQK3+7gob/Mta0pFIGw/c3AkdTBftRT1jt9XP?= =?iso-8859-1?q?nOT/UpBMh6l/KVShW83uo?= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR04MB7158.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0deeb98-e63f-4c09-4367-08d9b4d6d9bd X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Dec 2021 14:28:31.7740 (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: L+hguYw/mr6ZDCZvQbM7eLqsaDiEjHUKJ2e9qUrTbuKnO7oRKzDVLky25qQSq5ZEniVkxkGNQGcWOyDw29qnoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR04MB7576 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Niklas Cassel Make sd_zbc_parse_report() use if/else when setting the write pointer, instead of setting it unconditionally and then conditionally updating it. Signed-off-by: Niklas Cassel Reviewed-by: Johannes Thumshirn --- Changes since v2: - None, simply rebased on patch 1/2. drivers/scsi/sd_zbc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index 749c5e5a70c7..4735cc7f682c 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -61,9 +61,10 @@ static int sd_zbc_parse_report(struct scsi_disk *sdkp, u8 *buf, zone.len = logical_to_sectors(sdp, get_unaligned_be64(&buf[8])); zone.capacity = zone.len; zone.start = logical_to_sectors(sdp, get_unaligned_be64(&buf[16])); - zone.wp = logical_to_sectors(sdp, get_unaligned_be64(&buf[24])); if (zone.cond == ZBC_ZONE_COND_FULL) zone.wp = zone.start + zone.len; + else + zone.wp = logical_to_sectors(sdp, get_unaligned_be64(&buf[24])); ret = cb(&zone, idx, data); if (ret)