From patchwork Wed Jul 27 16:22:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 12930563 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 0A7F0C19F28 for ; Wed, 27 Jul 2022 16:25:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236252AbiG0QZf (ORCPT ); Wed, 27 Jul 2022 12:25:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236579AbiG0QY0 (ORCPT ); Wed, 27 Jul 2022 12:24:26 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 115524E62A for ; Wed, 27 Jul 2022 09:23:18 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20220727162259euoutp02cc17c789905ccf1a582c5a324890e539~FvDZu1F1D1023510235euoutp02F for ; Wed, 27 Jul 2022 16:22:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20220727162259euoutp02cc17c789905ccf1a582c5a324890e539~FvDZu1F1D1023510235euoutp02F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1658938979; bh=BDysFYNk87Sy+iH2ATaUwA/CYoqH1bPuiKpwIv4PNH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l1FC8joZBs9tULMFGdL9Ltz7W21raE/rNqGHEOWXYMNwJ68Ynvg6rwUugydf9GrTY GBCzwzoG7swv6IG9PLA1gcj6ULYYH1GegcYK5knN3IeVjDutu8JUF09dhw/RzoiL2c rxAUX201grV/N8/Vwaz3GGJznSJkjxSm0gS/+8e8= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20220727162258eucas1p217e6f4283b34ae7aa09a8668412c0d1f~FvDYUb_zX0838408384eucas1p2G; Wed, 27 Jul 2022 16:22:58 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id F5.C3.09664.26661E26; Wed, 27 Jul 2022 17:22:58 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20220727162257eucas1p2848a75c4aa7e559abb5d9ae0fbd374c1~FvDX8AmGA2220522205eucas1p2B; Wed, 27 Jul 2022 16:22:57 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220727162257eusmtrp1b431db91f9d620ddc563d89d431e4200~FvDX7Mt3d0298902989eusmtrp1R; Wed, 27 Jul 2022 16:22:57 +0000 (GMT) X-AuditID: cbfec7f2-d81ff700000025c0-f6-62e16662e688 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id CB.8D.09038.16661E26; Wed, 27 Jul 2022 17:22:57 +0100 (BST) Received: from localhost (unknown [106.210.248.8]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220727162257eusmtip1df9def4b055afa74f07522657e052479~FvDXkL73Z0050700507eusmtip1j; Wed, 27 Jul 2022 16:22:57 +0000 (GMT) From: Pankaj Raghav To: damien.lemoal@opensource.wdc.com, hch@lst.de, axboe@kernel.dk, snitzer@kernel.org, Johannes.Thumshirn@wdc.com Cc: matias.bjorling@wdc.com, gost.dev@samsung.com, linux-kernel@vger.kernel.org, hare@suse.de, linux-block@vger.kernel.org, pankydev8@gmail.com, bvanassche@acm.org, jaegeuk@kernel.org, dm-devel@redhat.com, linux-nvme@lists.infradead.org, Pankaj Raghav , Johannes Thumshirn , Damien Le Moal Subject: [PATCH v8 11/11] dm: add power-of-2 zoned target for non-power-of-2 zoned devices Date: Wed, 27 Jul 2022 18:22:45 +0200 Message-Id: <20220727162245.209794-12-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220727162245.209794-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHKsWRmVeSWpSXmKPExsWy7djP87pJaQ+TDCY8Y7NYfbefzWLah5/M Fr/Pnme2aG3/xmSx991sVoubB3YyWexZNInJYuXqo0wWT9bPYrb423UPKHtL2+LyrjlsFvOX PWW3mND2ldni89IWdos1N5+yWJy4Je0g6HH5irfHzll32T0uny312LSqk81j85J6j903G9g8 drbeZ/V4v+8qm0ffllWMHptPV3t83iTn0X6gmymAJ4rLJiU1J7MstUjfLoErY9XTI8wFm/Ir Dk7sYW9g3BjdxcjJISFgIjG/cQFrFyMXh5DACkaJl53d7BDOF0aJ7t6tjCBVQgKfGSU2bbSF 6Tg2cwlU0XJGiRmvJ7FAOM8ZJa5cusTWxcjBwSagJdHYyQ7SICJQLPHwXStYDbPAVyaJzX3v WUASwgIxEn1/ZjOC1LMIqEr8u5oCEuYVsJbYPXc6C8QyeYmZl76DzeEEim+eMo8JokZQ4uTM J2A1zEA1zVtnM4PMlxBYzSnxbMpPZohmF4lDZz8zQdjCEq+Ob2GHsGUkTk/ugVpQLfH0xm+o 5hZGif6d68EekADa1ncmB8RkFtCUWL9LH6LcUaK99zQzRAWfxI23ghAn8ElM2jYdKswr0dEm BFGtJLHz5xOopRISl5vmQC31kHiy9CfLBEbFWUiemYXkmVkIexcwMq9iFE8tLc5NTy02zEst 1ytOzC0uzUvXS87P3cQITIKn/x3/tINx7quPeocYmTgYDzFKcDArifAmRN9PEuJNS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OBgPMUpwMCuJ8CZE308S4k1J rKxKLcqPLyrNSS0+xGgKdPZEZinR5HxgusgriTc0MzA1NDGzNDC1NDNWEuf1LOhIFBJITyxJ zU5NLUgtgulj4uCUamCy3xz058yTv53JV0wdOh5s5PbfGyD1q0HaYtJj3lNPf7L3CgbNZtv1 MfaPh6XK0Q8lmTc/rAqou5lm72l5c7Zz5iuHl3cM+gLiD8fNMPe3XbDCJm+vg0pD0r5bZ6ct YbSa2BRzPfjMuq5TPr6nk9+u2W/2kpVf2uDynf1nHVzzLKdNMLXTFLb0+1Bqabr891TmjLD6 K9/v7uDe9+f60y2dGzPmK09sPnLXMTdEfr2ObXkc3/qJDm5T/qa80/L47R7M1uV990Ylq2Lm Xkvmlqqzi5dOCvJS3+5xUru4sK3rfQLLBz0Hptb2LJ6uJWnzz6uHdt7427j/xBc9HVlXv3v2 SfxtkVcXdr1xivrYKqfEUpyRaKjFXFScCAA5ZpvlXwMAAA== X-CMS-MailID: 20220727162257eucas1p2848a75c4aa7e559abb5d9ae0fbd374c1 X-Msg-Generator: CA X-RootMTR: 20220727162257eucas1p2848a75c4aa7e559abb5d9ae0fbd374c1 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220727162257eucas1p2848a75c4aa7e559abb5d9ae0fbd374c1 References: <20220727162245.209794-1-p.raghav@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Only power-of-2(po2) zoned devices were supported in linux but now non power-of-2(npo2) zoned device 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 zoned devices, it was suggested to create a dm target for npo2 zoned device to appear as a po2 target so that file systems can initially work without any explicit changes by using this target. The design of this target is very simple: introduce gaps between the underlying device's zone size and the nearest po2 device zone size. Device's actual zone size becomes the zone capacity of the target and device's nearest po2 zone size becomes the target's zone size. 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 All IOs will be remapped from target to the actual device location. 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