From patchwork Fri Nov 26 12:55:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 518662 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 B9978C433EF for ; Fri, 26 Nov 2021 13:00:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236705AbhKZNDQ (ORCPT ); Fri, 26 Nov 2021 08:03:16 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:2592 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235547AbhKZNBP (ORCPT ); Fri, 26 Nov 2021 08:01:15 -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=1637931483; x=1669467483; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=uawh6T6Xim9vStSjmO392m9Vpg8CS/1iKqbSt7AYcL0=; b=j0vf7Rn/zt+emTYiCq+v1ha1W+/Tz0cdC6sZKgbfo3vHXodZU/0fXbTL 5Hcy/JP//RfX0nBlggwGyi7bLtgSCuZsLWVfCGqctXqwF40xkMDp3hrmT bjcwVQa2l+rT7QvWgRC632144wPVb/YQRTzpLyz0PaiZoP4gLCgeo/MBo ucmdwjRskYgaxhkqC9Fhr35ROWPCdRZSfBBPUVl6GnF/k3GHAvOEQ5it8 p4oPiyfdIiwRWuR9Kswp+ABs2grcHlDo7GSjFhoHWusMycKEr0EXeHNYZ ONQi3dDAked/lJrxdtJJ+1D2tLiyNKXiqboklETXnwD0fCKpbCym06xU1 g==; X-IronPort-AV: E=Sophos;i="5.87,266,1631548800"; d="scan'208";a="185724645" Received: from mail-mw2nam10lp2102.outbound.protection.outlook.com (HELO NAM10-MW2-obe.outbound.protection.outlook.com) ([104.47.55.102]) by ob1.hgst.iphmx.com with ESMTP; 26 Nov 2021 20:56:02 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yn/6C92FXQjSfolrobjsw+feSW7Lkaf+M80YYuylWTAg3iONmAP4npSKwgpJDWM64//bn4tHI72MwzSWX2gclcelVyMJKDhh3COLvtvkzkKt2QPulOqExdnh35AALM9dUhiI+EJGPY9rA9Fu5WCtoJ1/9hTsdeXViUI2EVJ6MTL8l27xL1vRo6rWSv29E+huxKAeY6rvfI8d09sP5xmUe0YMD1eR/ID+JmqjgICppYOOrsKvGj9Y1a+BlLlNIxFysNDnqkAW8zwe7Wu/RXtvQszEPU1CWjmwEOHsj/u4dj+8CLiqQhBNzQNNRs00/LU8jCImvEZ/FBJcfFZO1NBg4A== 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=Yv6kUxBtz9sz/Qd6i2mUDyN7cTdDl/bhBqUgbsgoXtM=; b=BjJm6MuqwZGzCZMW5fi+7kbsKX75BlRnLTqZp6n0+hwxV/FWumJT8O1q655aUEJy6J0Nb+gBpe+frT1FdT3rl/cEcjLm7M52tc3yM2rBmcAkQxL+NK5G9gHU0xcf9XrWyA3yr7/oGUIfLJvrlAAV/xrNEIRzKth5OoVXbCutGHm8EHc3gTiVEYvTx6XHOq2jsXci9H6Cfy9r4er4CdMJUTDxJC5oQcZ7bRNrY1lsrzENcnGiKVw3vVbkzG7N8XF4yrqTRUrxYUMLKQgGkynRATeFJ+Ux3vnrLyq7B2wf0KRmEDClSA5LnJ0u1TsNqubmIEntqVlX9IofsRsfinZQ8g== 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=Yv6kUxBtz9sz/Qd6i2mUDyN7cTdDl/bhBqUgbsgoXtM=; b=MgBk6Sm0xBNsqPuCClIFhRW0SRaJI19k8y/P9xN7ErLDlQhm0qgHTUrzpcbh7lBGv2//HxDTM2UdQak+8X9TTPuxSGXJWNqx7tjKI1YDSVzLYX791xCLVVE2ziAFg2RuyCPkHBn7lWMlLI2WLORLDZl/enEAEGvUOzFsnI6FUP8= Received: from PH0PR04MB7158.namprd04.prod.outlook.com (2603:10b6:510:8::18) by PH0PR04MB7349.namprd04.prod.outlook.com (2603:10b6:510:c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23; Fri, 26 Nov 2021 12:55:59 +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.4734.023; Fri, 26 Nov 2021 12:55:59 +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" , "linux-kernel@vger.kernel.org" Subject: [PATCH 1/2] scsi: sd_zbc: Compare against block layer enum values Thread-Topic: [PATCH 1/2] scsi: sd_zbc: Compare against block layer enum values Thread-Index: AQHX4sT1wmIgicv9UkS/qqm8MDen0Q== Date: Fri, 26 Nov 2021 12:55:59 +0000 Message-ID: <20211126125533.266015-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: 0ac9545a-2374-489e-98d0-08d9b0dc182b x-ms-traffictypediagnostic: PH0PR04MB7349: x-microsoft-antispam-prvs: wdcipoutbound: EOP-TRUE x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: l5joOwHEyBBQ+elWpwFlAWp030kI/4fUYqaiQ/8evryb3AEk9MRrQLzibVRApR4PVDo82whpThCJWU8hYKquPwtBYrCTNXZZo1jsPKy9xeb3P9QgHVpIl/cyaSHYGkZ3ui6zLiimLH2maUoMLeP+zrtP73/VA8rSWTd3R/WHahvsjCgot6V6knEKcLyq1vG2PDq2F2OiuL8RfA/P4Y/nDCZWlIPEWXjv/MLDMkgrnzjSuUsqviN26eGZeRt6LK/iEO8De7pmGZyqCm3I6Hp5JmSkmY5/5Ovt8KYj3U7TrBzcaY/k3HeDFC+zF2fOtds5LChAORuShHsgnjLNHUCryoFU/z/EAFRIpEj04KUXhky2J4yqzSUW809yJ0CdnPS78EOx4T/ZGsq4HPIWlkXCtfteNgYE5UoVVkDVxC0e5u4ymgArNuBvoeeWiB+xJFMTte0ZFJUgjk6ZCqPvwPHosIhmODfv05iMIzifd5v1xmwlxBX33a+oW8QhZZGexOe1r8Z99XSrlvUKuEsVS/1U3JxfBFpEkxRXxaO0P1uVDbqa0SBcbG8AQojNpBHtKXW3+1sTTXlFP/25OgYym5zPwBNzcvZIAuVlTHm/9k3UoLbmo2ojvJp2yDFcoL60iJEhw/gYbCUK2IoGqgPiLrtSFsdfGcbbd7e9K3pSrnTSyJiixLhDQy9gAc972+M4FDflJ6sqdSIJGsR2BfRXwZeCAw== 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)(2616005)(4326008)(82960400001)(36756003)(508600001)(6486002)(26005)(122000001)(86362001)(66476007)(8936002)(5660300002)(2906002)(38100700002)(186003)(110136005)(71200400001)(316002)(6512007)(83380400001)(1076003)(38070700005)(54906003)(64756008)(66446008)(6506007)(66946007)(66556008)(91956017)(8676002)(76116006); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?FyO1E/JUh64aHiQOiFQSoxZ?= =?iso-8859-1?q?QKDhJbuWZ0uAaWE/Z7ygpoaDE4gZCApBts8ekiMy5jM0RgzU36/7faJ1vxam?= =?iso-8859-1?q?WX+r4qo8Yh39HAyoOVeGchiB6kVySG1oZzlPAOg+Rau8/sVhRkLEAMh9EfHT?= =?iso-8859-1?q?K5HScwvysP3NkwNkMCZs1sc7iNyPTG2u3oOntqff0TDfZC2xlDJtZYXspJbq?= =?iso-8859-1?q?6+KQMeW33nLnzC+OJ3hv6Sl/18Q69BrbRyDrO3LmEmDWErAQy4s/vZdwyKEP?= =?iso-8859-1?q?RNiTCwtGcN2zlmttkgPcW5EO4RyTwWPza3zZl73pG+ZRfFpioB0Isi0XZJpN?= =?iso-8859-1?q?9vA+q9owQOkFW0pPpebe1dRZgmRnfdPtbvqwE7UvD9u03K7q546/AwWJjCEG?= =?iso-8859-1?q?c5JEGOXikojrweYuwwbt9ZsJT+6BKloBInAR+mjk6eh/CI9xGEEe72oeC62f?= =?iso-8859-1?q?u5wBe3ZaOOO+ZES5SdRZJTJt++TTeiWRNz5d1NYWow1s6awgOg/ITQydK7lu?= =?iso-8859-1?q?qPv5PrUWBN832blWjTNHbAehKm6ai9wp6JAtyBN6+fNyzriiS0IwWdKYs2E4?= =?iso-8859-1?q?EJYGak71vsGlq7SygudDsaqsDgeLIpBWmTPrkPkpzIWw3Tt9nwa1XOMvcVla?= =?iso-8859-1?q?AZYiAPFFsV+pjTb2XiwJTM4yWny6wuheEyQ7kilLlGcAiFKLeYr1yJYkXanq?= =?iso-8859-1?q?JpWRKS1+VsZIlGCXOS/evupOD53pOxmTsNIMwwnBQCwqAB7cJuyDOVQiNdTr?= =?iso-8859-1?q?2KfeRxOzADdnxlj+Q+b+DkDsA7wF+1zisLEMqosmXJfVU1Qc27UDJFbnL8HR?= =?iso-8859-1?q?vLU08KLVRvrnUYQ9swwOvEHNq2KmK3o7vLHSHQgvbk8uGjMMI06hALsScBbJ?= =?iso-8859-1?q?PvNZJm2mnWxQ3Dmr8Wj84Ti+2k3bYZPfz/kC6JLKr78dPS+uS9b/Xfif3drg?= =?iso-8859-1?q?8dnj7yDRp/Dxxz0A9H46pNk4F5zWTdqEA6lohPci1zY/2B6GlWTlLEnc46xO?= =?iso-8859-1?q?GmTu0c6qGIjXFmDq/jSCfbdsFEYJ6KSHe2ckwN21O/82WTuIDGYz0vWGNEyI?= =?iso-8859-1?q?iE3yOuynPVmgKqtFoh+hKfGoj/29rEoKibLPE3aia3szJnFXUb8K+OqXyP3X?= =?iso-8859-1?q?w24OXruRjTKwl1WyggrUMxg+E9eI0nowhZ4yHFSBLcWFhGe2Qe/K0bUTMqpM?= =?iso-8859-1?q?1UePIH0GSPPtHwRsgr1g40lWFh+y+sgZrUJr/MHyPbTvhj1lp7Vy9cSlfXry?= =?iso-8859-1?q?OlQQf4OGRbz3vOjRxeFc6seVZwmw4jU3LZoRgVa/Pm/fQHea5maCBpV+xq8N?= =?iso-8859-1?q?8ZCJ3UgiPqu+VqUTKCmrfhH+YFZJtfb0cO3RdZI4HVXy/pWbiYf4Rji31rPY?= =?iso-8859-1?q?J6rTjsb6ozut6N8pPyMPwBOmmjFD6zsua27BSrB/oDc4zjCJT3YV3nOLKSHZ?= =?iso-8859-1?q?BR4Vpg5GtSRNo92P44FEwbITLwRkkn8lw/dCTVHRAVa2ynQd70E+0p4MRnw9?= =?iso-8859-1?q?QhNAPb2dBdtH3H4qcMVzproiudn1h8rjs2tw3+eHLIsA5wTe8Ue2N+UDQm1G?= =?iso-8859-1?q?dJx9RJ7oyL6KeO7AncjbS93kfLK8wpyO4YAZPfDQeWXa2XvqV71dAokPUEpB?= =?iso-8859-1?q?DvYH2B/tpYZzNkjFZPgEZZfyOfess+Ez6cRGvVoTqCHjaCa2yMJpbtqQSpR2?= =?iso-8859-1?q?ZURl4y1NERSP1jtjQUrg/?= 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: 0ac9545a-2374-489e-98d0-08d9b0dc182b X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Nov 2021 12:55:59.3235 (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: n6vCc1C0iKO8aRG+Qdl1PGA8k1WAALwoUNQNOMW+cefErRaIy+7LmIN2CXK6r/vPf9taFNse7GakKtJ3h3Eirg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR04MB7349 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Niklas Cassel sd_zbc_parse_report() fills in a struct blk_zone, which is the block layer representation of a zone. This struct is also what will be copied to user for a BLKREPORTZONE ioctl. Since sd_zbc_parse_report() compares against zone.type and zone.cond, which are members of a struct blk_zone, the correct enum values to compare against are the enum values defined by the block layer. These specific enum values for ZBC and the block layer happen to have the same enum constants, but they could theoretically have been different. Compare against the block layer enum values, to make it more obvious that struct blk_zone is the block layer representation of a zone, and not the SCSI/ZBC representation of a zone. Signed-off-by: Niklas Cassel --- drivers/scsi/sd_zbc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index ed06798983f8..024f1bec6e5a 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -62,8 +62,8 @@ 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.type != BLK_ZONE_TYPE_CONVENTIONAL && + zone.cond == BLK_ZONE_COND_FULL) zone.wp = zone.start + zone.len; ret = cb(&zone, idx, data); From patchwork Fri Nov 26 12:56:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 517522 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 5A932C433EF for ; Fri, 26 Nov 2021 12:58:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235902AbhKZNBQ (ORCPT ); Fri, 26 Nov 2021 08:01:16 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:2592 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348845AbhKZM7P (ORCPT ); Fri, 26 Nov 2021 07:59:15 -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=1637931362; x=1669467362; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=4/q+JY+ZmDh1uNqJvDKYK/AB9nKnNhlCwBVSg9euqi0=; b=fydDvjwnxRFz2WL4eYHPS3NUp9wqFpUnx9Ja7PrBfK++47RnFCJgWvTL zCw99oNxxlX1l4RdJcSvpB+BLNY6INT9c5gxYIUA/ZBu5yyzWD0LvyUv4 pQr0i055AYO2BfgxD6uce+3j9Yon8uP5nls1cHzKB7htTo1H7dhAy0kaa ep5LMwJxOotUQT2QSNl+DmoJoOoZTH43xgWjjb041Uu10nK5bOdougj7S wvvaZvqbidMDUg9NdRBXOZkSwExAXHyib9G54Yz+/17pmZGj/Jsb9FBfe wrWYlZGABS8vZIqsu5nrcWvu+2CV6iowpw0mCVZABxUps9U0KLWiZpJot Q==; X-IronPort-AV: E=Sophos;i="5.87,266,1631548800"; d="scan'208";a="185724642" Received: from mail-mw2nam10lp2102.outbound.protection.outlook.com (HELO NAM10-MW2-obe.outbound.protection.outlook.com) ([104.47.55.102]) by ob1.hgst.iphmx.com with ESMTP; 26 Nov 2021 20:56:01 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DIk5m/D/NpFxuCsoBxkt9Rirgs/k4+qLYgMMf9yK/ANWaYYulsz6gn+/9Pl+YWa0BRy/s4g+kYFUtijbVB8608V/2gVYkiRseYGKZJZcSjTAU7AfHrbUBNFmEeRbh5rrsO1XpLm/iqZWPJUILDtA+Jo/tLoflJRVksYDp73Om67NSppAJv6o3bKppdIlpUFKDiYiVO/9O0g1X5ct0RFRMpJ4krhwddaoSzNmZ28jWiLpCSdo9ZTDf6K8/XzkA1dzSGObRthbtgeVe+vtq+tdsZ2E9mzckAWRdjceq6FDAkRQPxXftcSMWqA1E0Pg8n2AL5jmuFuBubvgiOKFtfbr1g== 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=TykXflVn2a9ppDebqtHnNPCoBMj34MGrCsSzyEB6D9c=; b=SYLHS7MSZkEBp7DspMAnDF5kf/C5BTCR7DZDRlg31Spu8djBvpAoW54ofLfAhKzCZwbusfOJiU70aQkSJk1CF7L08Dh4doX0+zdmCFMIms3WT6B/bbYxJj7lE7WUYw/IUaN7fsrLSkMXKJdaTUQhrfLcVw8W3Br8K4VEYop8ccuy8dgd8ekGBNqjQJ1hvViOasnyBPdIr3hCNzFhbnjRq8AbCPtzsXsDe9iE9D15UjfpbsPr2RX1EMTi1BIrL4P5cpcKBcFWiIOAdL1+L1KvGHbkBZu33L3xxkSXBb4BYaBA2xJcVA26Wy3RELUhxdP3ewfek7DfrY3gIxp81p7ENw== 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=TykXflVn2a9ppDebqtHnNPCoBMj34MGrCsSzyEB6D9c=; b=RFCErm1UEODIxy8TbO9lnA+dQD4rRV1qI/XkZyim67uIFUoM4hN5S5wNHmsb0Eg6kkXdSX3M7M9QXSg1V2vUpwdBB3+dQo39qXTIR0Uw/DcqxqBPlyFN6rKCHO77Sl9VEWKjfOfM46a9lBwwMUQIU/CYk/UPIA0hSEcuAGCWQxI= Received: from PH0PR04MB7158.namprd04.prod.outlook.com (2603:10b6:510:8::18) by PH0PR04MB7349.namprd04.prod.outlook.com (2603:10b6:510:c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23; Fri, 26 Nov 2021 12:56:00 +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.4734.023; Fri, 26 Nov 2021 12:56:00 +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" , "linux-kernel@vger.kernel.org" Subject: [PATCH 2/2] scsi: sd_zbc: Clean up sd_zbc_parse_report() setting of wp Thread-Topic: [PATCH 2/2] scsi: sd_zbc: Clean up sd_zbc_parse_report() setting of wp Thread-Index: AQHX4sT2GcpwnIKOLkekqsyXmCouYw== Date: Fri, 26 Nov 2021 12:56:00 +0000 Message-ID: <20211126125533.266015-2-Niklas.Cassel@wdc.com> References: <20211126125533.266015-1-Niklas.Cassel@wdc.com> In-Reply-To: <20211126125533.266015-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: e9ec9ed4-2220-4959-05b1-08d9b0dc18c0 x-ms-traffictypediagnostic: PH0PR04MB7349: x-microsoft-antispam-prvs: wdcipoutbound: EOP-TRUE x-ms-oob-tlc-oobclassifiers: OLM:1360; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: u/+IN7fkZc1Bo8QDj/W/At4WohC5lpomVku4B5phGpg5i6zt+3l/1zSKVYBdWoqcOxpBWh0YLUEg5iluB47qFIu0o/iRd5MI6wgHwBVF6Lu2N7dVQQEpzqYqEDmXza6oyVXuyqKdXF2r/7MkBUzjY7hF+wYpOZw9RSki/hQ5ado9el4xHPHSP/wex96+nguNsaukfgn2neuAqHpIrFlte0cFtTkBoy4Psuf3LUA0d3MBOtGLO3fLoM7GUHTywI2zPsfn7AsuhpaIvim7JMXaws8mpKJWEEqCG77V4yVfllGy24fIUQmzvJSd3wFklEvZG57I65qDuHMbA/aluiXzXplUEiYROUBSMyoAcTu7LghfGecbAgHuXPMNl7Tlj0A9knaj2emT0av+HkZaitsXfPIoK7P43uNztJ8Sxwu8sMb4B1twGqXB9xp3MTQwi7zCk2JZLkT5hlIphCCj7fikDtYsXbpRLehO1FSigfAvXrscilgS1eDxigjxNHIQA48sRK0w/xAswf/4O6hds2M/9zaCvFfywDh72KtsLoqf/NlBATM/RqM/Ry0hqC6sCRfE3Cjol8YGkfQayEFTDW6DOnRqIiQVdYAME3ipymoOPEe0jWWpMCPbSyfjdX5jexb+nfmTXzjdAjCXgtMt230wYXlTtVFHYZ9XMRGGlXQ64TmjPVoBJ+05yjGe7KFngHoufdz494AfQuNNijJt0xxGnQ== 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)(2616005)(4326008)(82960400001)(36756003)(508600001)(6486002)(26005)(4744005)(122000001)(86362001)(66476007)(8936002)(5660300002)(2906002)(38100700002)(186003)(110136005)(71200400001)(316002)(6512007)(83380400001)(1076003)(38070700005)(54906003)(64756008)(66446008)(6506007)(66946007)(66556008)(91956017)(8676002)(76116006); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?/gPRJDQlV+rrB34X016vbZm?= =?iso-8859-1?q?hFlO2qNgBpYp15Dfaqalyh0fHWvi6fI0oaoKSUUfnwYdFO1/csd2R//1k8uv?= =?iso-8859-1?q?4GQKmJ9NMqb3qd18HuWFWzYluHApO2bnfyUADoxzEPC54aadrTBRF2eoU3PQ?= =?iso-8859-1?q?vN3nvPgWk0nMc+j3bMK5ECld75YmA+VBMvgtrNp8JLKfkD7PSETJohkz2zLE?= =?iso-8859-1?q?SYeSm70xfCALetfi016CChnkwYHM+nzYY4ABlCQUpG556o3CmzhXGY361F3W?= =?iso-8859-1?q?J+4/YDWmR/rYf1MD+m/WoY7BTapjT282KwA3+lqBp18r4AbCmTG9qF58qqXl?= =?iso-8859-1?q?U1/mHdZAMPoarI3fyVjcdBGl4M/hJSE71B1XR2JQ5IXtd1yNBwKs231lpstr?= =?iso-8859-1?q?x7VD09lxPQWUo1z4KHoGFMVUz585hAdKCSViolte0aZbUKjH1H2U26DjcGDT?= =?iso-8859-1?q?NVBUUGMfigYxEyfyjud3LfzijPSePIih/YZKmgmMNfK7res3x/sfh0eZefGy?= =?iso-8859-1?q?WfLnMP39cYNPuKAuuZ5Vfz/gR0pTJEFlqNaPlPltvrj1FbyPOmzpoUZ+DgRl?= =?iso-8859-1?q?Pei0cEo6Z9MxkiT6ykh8j1Of4dS3TKlb/iiIK3CZMRa8aDC0K19i9G9oD2gK?= =?iso-8859-1?q?zIUiLpvH7eGEkXOzc/zPLnOnzNo51JWWfuBSPepjjyy8V+cLjYEhdP5Usa02?= =?iso-8859-1?q?mKWF8YStPVQ69ZZKW/mUGY3tQBYDH25i0UKmAoVL6lhlk2muPGEEbIF1aP2d?= =?iso-8859-1?q?2e5DVFMMChmeh8hUNn8ZwXC/aZTorn47iyPh4P/MFEUeCectbnTLnzMzFM4Q?= =?iso-8859-1?q?1sd2Q2knpbIDkcNGzBzTHJ4ovr3BVnhhAjdmEuFoPctfttuOAx+FWKXeyVyb?= =?iso-8859-1?q?MHQzFTfjI02qRJeaanweYU/sygSnuWS5amGkOtoeLxFuLqwPiJYxmdaqpNwZ?= =?iso-8859-1?q?o019kmw+FX9EdqPG7vjttM/XRcJMYSJ8/rj3oM6foPK8dFHs3GydnRbUO9Sz?= =?iso-8859-1?q?VelF1zohIW4oQZqQ+h+JEhs34RbaU29tw4L+he3GbS/60GzFh0JC7cTfUqPF?= =?iso-8859-1?q?UCc4Ef0GCD5jawkOtiiZTijCkW7fCCmxEWC54r9nljC59wsK7yWgJigTTyii?= =?iso-8859-1?q?xkWda3jrtcJ5YV4mhqxAh2jkdYJFOGU4JAbUv+lCX0/FZAUegUzZXSEL7u09?= =?iso-8859-1?q?WBsLwH/yCZgbLpp9q/Fb41j59zC+3HaDHKtpnGVPzT0zuHRoDEBCQiFe7YOb?= =?iso-8859-1?q?67AsdXy44/oWdCxWFxs+5HFA25SYD14k0exrDpbPYc8naPo7uVOq9p0qKiEC?= =?iso-8859-1?q?Sy1gkDmzVYGrRUquzp7tLCaF8u7hOydfvqsFg1mZDM3M2Olhvf4tTlAuNI+W?= =?iso-8859-1?q?QsJwHbiOv4Ed8HJXf9Q7FWEr2DLiDez+Qz+Dqh37kna3HiYw+H3X8cC3Esnh?= =?iso-8859-1?q?6+wNSOu7RJqaAfzYsodbYZu46BXDCFG0JxiFFKqzY8WOK2EqfWJ0iGpukQsB?= =?iso-8859-1?q?mkqCsWlD0e+QwPTTNHUnj0zjK05BnQNlTeNWRDbZv08EnQH9ZG9e3Bhz7gxB?= =?iso-8859-1?q?0eUvaQ3S0ZcTdeo9hGgAiR6cYzpX0Bue4YDNLE7jugR5+V4or+tKkd+WCjJQ?= =?iso-8859-1?q?/scKBECnVQZWW/AZJjSHn7QXAAGqdgolTYvDanrSqnVS3VJkwXFUGOsejyan?= =?iso-8859-1?q?YF261Wtm6rtHILCrVwy0/?= 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: e9ec9ed4-2220-4959-05b1-08d9b0dc18c0 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Nov 2021 12:56:00.2285 (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: VtxEGgWujgkZMxg/SBRLlwYpO/+xHLzIOH+cZ4R4kluWGoHM0zZzzRN+OS6oqf2dsIn5dD3N2AFDK4PsARPkbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR04MB7349 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 --- 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 024f1bec6e5a..3e25ded3ac0f 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -61,10 +61,11 @@ 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.type != BLK_ZONE_TYPE_CONVENTIONAL && zone.cond == BLK_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)