From patchwork Thu Aug 11 14:30:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 12941486 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 02F98C25B07 for ; Thu, 11 Aug 2022 14:31:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235143AbiHKObP (ORCPT ); Thu, 11 Aug 2022 10:31:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235528AbiHKObE (ORCPT ); Thu, 11 Aug 2022 10:31:04 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 085E96BD48 for ; Thu, 11 Aug 2022 07:31:03 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20220811143101euoutp01940c719f61ff212e1e26e2325b9b4716~KUM7TzfBQ2304723047euoutp01A for ; Thu, 11 Aug 2022 14:31:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20220811143101euoutp01940c719f61ff212e1e26e2325b9b4716~KUM7TzfBQ2304723047euoutp01A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1660228261; bh=IUoyViCkp3U4Q2I4KlB9fJBiLbxoRuZRmvXdr8vBKuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E5mnu1ZU8jhMXs7D+vSKNJsr68tpM3M8oXucQZ2iQUMgbQXrVnAHwTeyU3sYCkuFW EFxt6sGPcLduFfkNG6GLwcSZoVBF4aB9SOTkFcmXz5EW+17lP2qTeDlZ2agio1oo4J bQGtLGHVi/q62pNljs+JGU58AGMDq+fPmKzFZ8yw= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20220811143059eucas1p1e317135f18477c5d913e987c19bcbcbe~KUM5Yg33T1847718477eucas1p1N; Thu, 11 Aug 2022 14:30:59 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 3D.3A.09664.3A215F26; Thu, 11 Aug 2022 15:30:59 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20220811143058eucas1p247291685ffff7a75186947fd30b5c13f~KUM4hWTb42359623596eucas1p2O; Thu, 11 Aug 2022 14:30:58 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220811143058eusmtrp28f9fb8f8a36160410731318772fa88f6~KUM4gZwt30788907889eusmtrp22; Thu, 11 Aug 2022 14:30:58 +0000 (GMT) X-AuditID: cbfec7f2-d97ff700000025c0-15-62f512a3e869 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 89.9F.09095.2A215F26; Thu, 11 Aug 2022 15:30:58 +0100 (BST) Received: from localhost (unknown [106.210.248.43]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220811143058eusmtip172ed3770e81c435d3d628314002e940f~KUM4IHz2d1917919179eusmtip1b; Thu, 11 Aug 2022 14:30:58 +0000 (GMT) From: Pankaj Raghav To: snitzer@kernel.org, axboe@kernel.dk, hch@lst.de, agk@redhat.com, damien.lemoal@opensource.wdc.com Cc: linux-block@vger.kernel.org, Johannes.Thumshirn@wdc.com, bvanassche@acm.org, matias.bjorling@wdc.com, hare@suse.de, gost.dev@samsung.com, linux-nvme@lists.infradead.org, jaegeuk@kernel.org, pankydev8@gmail.com, linux-kernel@vger.kernel.org, dm-devel@redhat.com, Pankaj Raghav , Johannes Thumshirn , Damien Le Moal , Joel Granados Subject: [PATCH v10 13/13] dm: add power-of-2 target for zoned devices with non power-of-2 zone sizes Date: Thu, 11 Aug 2022 16:30:43 +0200 Message-Id: <20220811143043.126029-14-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220811143043.126029-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrFKsWRmVeSWpSXmKPExsWy7djPc7qLhb4mGUy5p2ux/tQxZovVd/vZ LKZ9+Mls8fvseWaL1vZvTBZ7381mtbh5YCeTxZ5Fk5gsVq4+ymSxdP9DRosn62cxW/ztugdU ckvb4vKuOWwW85c9ZbeY0PaV2eLz0hZ2izU3n7JYnLgl7SDscfmKt8fOWXfZPS6fLfXYtKqT zWPzknqP3Tcb2Dx2tt5n9Xi/7yqbR9+WVYwem09Xe3zeJOfRfqCbKYAnissmJTUnsyy1SN8u gStj0/dJbAXHiyumzlzN3MDYEtPFyMkhIWAi8XFlO1MXIxeHkMAKRok9Ly6xQjhfGCUuntjI DOF8ZpQ4v305M0zLkWcX2CESyxkl7nc0s0E4Lxglfm2/C9TPwcEmoCXR2MkO0iAikC6xfsFy FpAaZoHdzBKn3zQxgSSEgRKPpjaygNgsAqoSP39vAIvzClhL3Jh2jQlim7zEzEvfwQZxAsUn LLoIVSMocXLmE7BeZqCa5q2zwU6VENjNKbFn1WOoU10kVqx4xAZhC0u8Or6FHcKWkfi/cz7U gmqJpzd+QzW3MEr071zPBvKBBNC2vjM5ICazgKbE+l36EOWOQHtvQVXwSdx4KwhxAp/EpG3T mSHCvBIdbUIQ1UoSO38+gVoqIXG5aQ4LhO0h0bS1nXkCo+IsJM/MQvLMLIS9CxiZVzGKp5YW 56anFhvmpZbrFSfmFpfm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jh6gXlDg58wnYTGag+uats5knMArM QpKahSS1gJFpFaNIamlxbnpusaFecWJucWleul5yfu4mRmAUbzv2c/MOxnmvPuodYmTiYDzE KMHBrCTCW7boc5IQb0piZVVqUX58UWlOavEhRlOguycyS4km5wPTSF5JvKGZgamhiZmlgaml mbGSOK9nQUeikEB6YklqdmpqQWoRTB8TB6dUA5O2mKLIlXXfDO233PinFl6ySHlnjM2O7Ozf K7qPic2pPvdYNlvsSW3PvTNt76vXncjtXW3mv9NePGf/J/XXqbO/Cm1mlJzhHmCw/SRnxYf4 2LYz3j980i8YvNuVW7anTVG/QL6KkZ8z9tz+lefXsdZ2LLn7RlOc4Wyfl6zP/zhBRU6Vw6VF qWeTz2Sw32HoOH9iobxdpF9U81kl0Sp7013cV6wnzdV+cYB9ZpXPKcdW3dfaR/5EqNnN7Zoe cOtpx+2EdUt8WW6q8icLCF1OMpUoM711WzdH/f1eBpEEK9afHMGvRPyPtBa/Y23cM+93Xr7e 5rftJh1frnr9OrhvxZ0M5TUTFnUtfuw3z/F+mhJLcUaioRZzUXEiACsf2JRrAwAA X-CMS-MailID: 20220811143058eucas1p247291685ffff7a75186947fd30b5c13f X-Msg-Generator: CA X-RootMTR: 20220811143058eucas1p247291685ffff7a75186947fd30b5c13f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220811143058eucas1p247291685ffff7a75186947fd30b5c13f References: <20220811143043.126029-1-p.raghav@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Only zoned devices with power-of-2(po2) number of sectors per zone(zone size) were supported in linux but now non power-of-2(npo2) zone sizes support has been added to the block layer. Filesystems such as F2FS and btrfs have support for zoned devices with po2 zone size assumption. Before adding native support for npo2 zone sizes, it was suggested to create a dm target for npo2 zone size device to appear as a po2 size zoned target so that file systems can initially work without any explicit changes by using this target. The design of this target is very simple: remap the device zone size to the zone capacity and change the zone size to be the nearest power of 2 number of sectors. For e.g., a device with a zone size/capacity of 3M will have an equivalent target layout as follows: Device layout :- zone capacity = 3M zone size = 3M |--------------|-------------| 0 3M 6M Target layout :- zone capacity=3M zone size = 4M |--------------|---|--------------|---| 0 3M 4M 7M 8M The area between target's zone capacity and zone size will be emulated in the target. The read IOs that fall in the emulated gap area will return 0 filled bio and all the other IOs in that area will result in an error. If a read IO span across the emulated area boundary, then the IOs are split across them. All other IO operations that span across the emulated area boundary will result in an error. The target can be easily created as follows: dmsetup create