From patchwork Thu Nov 7 00:23:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: LongPing Wei X-Patchwork-Id: 13865668 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2067.outbound.protection.outlook.com [40.107.117.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC8EB7F9 for ; Thu, 7 Nov 2024 00:24:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730939057; cv=fail; b=VYmBSgTynQu3Ox0aCkZBFox2YhL2tSZhB+TVjs6IPRxCQemAFnJiSgjczOf+H2lCyHWoFZgmubuHBp0Gsd4zSx/Xe8rR9MdgT+8NOwE8nC1As7DFHZ36s/mVtIObKqkGjlMCpkqIOayznmGVDcRjZi9FyxjY06gT6rDS0RVaUa8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730939057; c=relaxed/simple; bh=DVdfLXIt8C3gyii5mXkkmsePYs0VROpUgkCYE1+2M10=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=CzWY5k6lHlyVLvNrq5tN1GG4SlNH2IaZWmrubXJuQE0pe96YRNZ9mKnPXaCQDayEb3kX7g4avQPIDKDidkwEPxyj7JgTfCx/Bd52Br0fCQY3gHr916Fx4p3KRYm94TUQYximIAEFqJS99O0ZoZwBKD7mT3TLpEgwLMZRRVs0QbY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oppo.com; spf=pass smtp.mailfrom=oppo.com; dkim=pass (1024-bit key) header.d=oppo.com header.i=@oppo.com header.b=cDUFlw3O; arc=fail smtp.client-ip=40.107.117.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oppo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oppo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=oppo.com header.i=@oppo.com header.b="cDUFlw3O" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VI0F6yQ88AjF41t/oPX2Oh5Y2D5n4gHlE0coZvfTsi/XCFoLUtpxc26JoLlYQEO/Xbw7zO1QlAxczW0BdodZKjGlZYHOcCV2rVKovKuvDClmObLcu3AUFfwkZ+xRCM7XT8w8vIKCk5Out4A6k6hJfSPtZ3lLC4fiGSDqVuiksVt9ofyV39oVOBw8uZaCa9hDp8iWf0xWVbgtjdGu13zqIKJsWTT6ZSmi5Mn+v7fsdn0UC7pLj71kHtqL/OTtB9pg5ZycfCOzc9hwD6IDVGqdf7O52gnqOAtlQZ1sLnNYddvhAXxSW/V59pfwLa0QLthpkUnhFvwPvkofxgoA5xLkEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=LT8NHOrbSkLR49lZbRS/1mmcO9oNLUw1+IXO0TWJ+UU=; b=k9Nvr3vd2bZdWFG0AZiCDyeIGVCDyxgJcFXGxvrVwizLw9e0NNUZeivznUeXaqf15urs23mzlBlKFAKPl1ENXByKwyOIB1MG4oewLfJfg6yAj7jN1eXfOjYAvJmHwDQF9HqE8Sx2W9aIEZKk65emPVCglcLXzYMyBhSkRbBbkogEFXfnbs2W5qdxQ8YRViBmzXew5Ia532kn1MiDGtBAyuO9FOHPoyVUHgxqptUneHOP2tHJYJpXoMjTJ7qXaS1tZmuUrwOGZlc8lYYEpB0IzXXOkC+/1M8mJBAKduFbFRRkh9731Soe/RlhSryASt+HHY+4mLyDhjaDMx57NdDvoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oppo.com; dmarc=pass action=none header.from=oppo.com; dkim=pass header.d=oppo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oppo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LT8NHOrbSkLR49lZbRS/1mmcO9oNLUw1+IXO0TWJ+UU=; b=cDUFlw3O/3h+bPfVdO2gVQ82VJfVfk5QmMLba5L+IbWZDnU21UcVzgnTNHxShyHdlEzoFpqjFXZJfbYxInl08lEU9ogDageVtjXxSNXKp7VtqjXPvklOh+e5eyJa3fHsCkecxk8gJHRpUFVqv6PmLHHEfTd9UgniI1LOpafbOmI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oppo.com; Received: from SEZPR02MB7967.apcprd02.prod.outlook.com (2603:1096:101:22a::14) by TY0PR02MB6857.apcprd02.prod.outlook.com (2603:1096:405:e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Thu, 7 Nov 2024 00:24:12 +0000 Received: from SEZPR02MB7967.apcprd02.prod.outlook.com ([fe80::5723:5b88:ed4c:d49b]) by SEZPR02MB7967.apcprd02.prod.outlook.com ([fe80::5723:5b88:ed4c:d49b%6]) with mapi id 15.20.8114.028; Thu, 7 Nov 2024 00:24:12 +0000 From: LongPing Wei To: axboe@kernel.dk Cc: linux-block@vger.kernel.org, bvanassche@google.com, dlemoal@kernel.org, LongPing Wei Subject: [PATCH v3] block: get wp_offset by bdev_offset_from_zone_start Date: Thu, 7 Nov 2024 08:23:13 +0800 Message-Id: <20241107002312.1643655-1-weilongping@oppo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SG2PR02CA0131.apcprd02.prod.outlook.com (2603:1096:4:188::6) To SEZPR02MB7967.apcprd02.prod.outlook.com (2603:1096:101:22a::14) Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR02MB7967:EE_|TY0PR02MB6857:EE_ X-MS-Office365-Filtering-Correlation-Id: c265dfbd-83a0-4030-fd24-08dcfec280f7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016|52116014|38350700014; X-Microsoft-Antispam-Message-Info: ZiSCeBSr+PuEOfBFfAMMyf4iWVu9rctet335hXwmbb4jaBJrWV4pBLLLR/HmmqaWdgQSxNm6rK5114N7UfWWEZcuyqTNoy/0HXMZW/h899NrZb9b+MD4OTovy/ykRJcyNmWFmA1chpeYYG5oyCZQOaS8w2E4e82mRBAf3VxNGGWUGbLxdFMQ+q8r/KmgALHO5VQmEY6qlntdc0/BNy3gWXVaumUElsQphLL3j+3W4dIlj+OubBxOKEfVCcj1iAh/GBq3Tt3eE+ILhJMNWrHS78+aK8Qmj5gVIcd0pskjqbtXnrjNFuOhFnNM2V0sfmE/83ESbggjVsKEjgs+KVsJbPkWQLs/uUhMhe9BCmZqQ0tDrvKk30ebqKAmdc0RI9JVFKZYsdkiKnTCbr9obzp+RCZrsKYV2brB1AfaCkZ6uBwJbIHPI9MpRnWhAvbOxVmTomUI/f0mRX8oaFwlUuG9rhds4IVdn7JHE+31g7MIcORUdLCIogHH8oDrOmXK96N9/G6NLn4t0FpSY60yz1G3Fux0LUQP4y57sAEuReeIBLflSPIZ/mZgERlLjs45t/iPe2m9iSLGpnG71ue7ihtu6NK3QwPAcjMOPkjMeNVWiiGqaLaPdzHi03kys7Us//zwl4kT/1sbXejvdFUyz6TrFhE2e9niXGJ0/4pzUcwLQyq/spwjHV+0ziRI7DLJjuVQ4wztQJt4BJRk18incn7aXcWl93vmSDtc1H/orWu3Y6XU7ErLB4sF6P9ZStE6Oz60E8+0Hgl3LgDvMNSFQzgNDXLWcAu99hNU5j1eWV8OmcImubF0kkItQhvAQNw3GfcrDYeRFhdq6Og0bjG/mP+1zdOCFHz8j3SarsRpaxhbJbPbgzT0pUeyEiZd2+4gv5ERzqY/83670XJoVQK9JblMj4R8cUUb/P5EOOlPA9ZT/KN7tlsM4LsrdjCcuQWq36JzweaC1pdWsT3rupr3njEfC4Co4D3AAbzvF4JTkrjTwybYLUeu2VYiqI8SHeluF30K1hV5RxQoGVNFKTu3mdBVNvdOeN7sq9WF7ohR+Xy1SZHDofVUylmo6p5gf3cVO/04tUfZ1UN8pnokHmHxxoRdAqE1OSKmxDnHhrFy3A6mqwPCd2Cbqbi2cTf1fbKaAaXyzgXLnkmKM8zqTRny6p/htF0d5Or0UvIHHqg60RIWFd7tOhi2RsJBxiz8B/YiKw561HhZWKsQxvNkrEQoF6cO9wD9u/TKHYn2COS9OBnLawfl+ak2Oe0VYKtjBI1xwE6VIXCcMR5WNIg+FaNt9eSOLs24qV5YoTww6qVAmzRm22TItng6WXWjFMJ/npgzqbAeSq0+qcMTQEHnUESh+69ctJ8HW5FkIk/xcrqJUw8fnVI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR02MB7967.apcprd02.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(366016)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DBuGRLUVLPpXr+XJBOpPK18O5vcKZa29lrlvDLdxf6544QwaP3M48zjj40wi639t1CC2N7V86hC3yLvChPPz1o0b+jIzeggcU2mVcsRjYzBciIb04hY5GPaHpa0/wj5UYqtHYyHoRvOJVlDPN89GYlgJBknyrHBOFxbnxadMhyahGvX8TxDE3r4V7DIbBJ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YcHhhjkPrmP155LAZfLiVDpR16xKTx3Gl+CF+9j+vN/Y5fdDq5Pib4r+UBs0KtMleYZg04wXx58G0NCm1woUhncyVFkAFsogzDSlByTk0vfoQ1elnIbt5sN30oP5NLqiXg4IbrqgP7W5GAEPzeDMfxGH7XXooHlzgK4wIO5T2QCDtV+MT8vOGmbuoY5Yea9F+WMf/zp7MGpuT09rCHzHj8Dq6WyOzhA9+3gBbUes1B9qAtOa5ddqvKOSU+mHIyiaPOm2B9ok3v1b8DBDjPg5xxWgtxQUoTuvPKwt4G7VAkP5ig5j1GEPXYgWyEMqYreycuy+B3uQQGV21Dskti0qH2zrGkJ455kGSWelA== X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c265dfbd-83a0-4030-fd24-08dcfec280f7 X-MS-Exchange-CrossTenant-AuthSource: SEZPR02MB7967.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 00:24:12.3714 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f1905eb1-c353-41c5-9516-62b4a54b5ee6 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oSMWc87h+7bFtGK3y2K+fD4mfAVNP2Caw/R/WX70UY3nSRCzrTXDxuSAsOzQ+Z2g0ikulag8gwFAwV+Q32aERw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR02MB6857 It should be better to call bdev_offset_from_zone_start() instead of open-coding it. Fixes: dd291d77cc90 ("block: Introduce zone write plugging") Signed-off-by: LongPing Wei Reviewed-by: Damien Le Moal --- v3: update commit message --- block/blk-zoned.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index af19296fa50d..77a448952bbd 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -537,7 +537,7 @@ static struct blk_zone_wplug *disk_get_and_lock_zone_wplug(struct gendisk *disk, spin_lock_init(&zwplug->lock); zwplug->flags = 0; zwplug->zone_no = zno; - zwplug->wp_offset = sector & (disk->queue->limits.chunk_sectors - 1); + zwplug->wp_offset = bdev_offset_from_zone_start(disk->part0, sector); bio_list_init(&zwplug->bio_list); INIT_WORK(&zwplug->bio_work, blk_zone_wplug_bio_work); zwplug->disk = disk;