From patchwork Wed Aug 3 09:48:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 12935340 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 6A40CC19F28 for ; Wed, 3 Aug 2022 09:49:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237695AbiHCJtE (ORCPT ); Wed, 3 Aug 2022 05:49:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237607AbiHCJsZ (ORCPT ); Wed, 3 Aug 2022 05:48:25 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B0B45A170 for ; Wed, 3 Aug 2022 02:48:19 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20220803094818euoutp0286c1f1e50b5f1d0181e5d30bdb4a45da~HzLy4-8-L1921619216euoutp02W for ; Wed, 3 Aug 2022 09:48:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20220803094818euoutp0286c1f1e50b5f1d0181e5d30bdb4a45da~HzLy4-8-L1921619216euoutp02W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659520098; bh=JRlwZvMkYHtnL6i9fUcNW6Rx0AlYf3L8pef0SqIDL+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jpn7SprunHmvg0K2JkszwA8zERuPieu2z7YdfKpovUYMS4iGKCuRM7RDJKL/3iwPi 73sFpX5WpV93cWeiaMeNAKXylBT+WKlOiiyFODIMlA3popdh6ToWOepcnIFjdOBNCh bRxqg+ogB4mY55Q0IQtQIlDXvaZxLERhR6rcuFAw= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20220803094816eucas1p1b2947b917caf6601922bdaac476f6824~HzLxRR4Ef3109731097eucas1p1g; Wed, 3 Aug 2022 09:48:16 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 4F.06.10067.0644AE26; Wed, 3 Aug 2022 10:48:16 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20220803094816eucas1p1890ceb4faebaf4f0cdbc9581d1308672~HzLwzq_rx1902519025eucas1p1R; Wed, 3 Aug 2022 09:48:16 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220803094816eusmtrp269f6b61586e288f08181b7c336900f37~HzLwy1l8g0972009720eusmtrp2i; Wed, 3 Aug 2022 09:48:16 +0000 (GMT) X-AuditID: cbfec7f4-dc1ff70000002753-6f-62ea446098ad Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 85.EB.09095.0644AE26; Wed, 3 Aug 2022 10:48:16 +0100 (BST) Received: from localhost (unknown [106.210.248.112]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220803094816eusmtip261e6159d7d5bba642bb130f09846acf0~HzLwcNAPi1679316793eusmtip2f; Wed, 3 Aug 2022 09:48:16 +0000 (GMT) From: Pankaj Raghav To: Johannes.Thumshirn@wdc.com, snitzer@kernel.org, axboe@kernel.dk, damien.lemoal@opensource.wdc.com, agk@redhat.com, hch@lst.de Cc: dm-devel@redhat.com, matias.bjorling@wdc.com, gost.dev@samsung.com, linux-kernel@vger.kernel.org, pankydev8@gmail.com, jaegeuk@kernel.org, hare@suse.de, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, bvanassche@acm.org, Pankaj Raghav , Johannes Thumshirn , Damien Le Moal Subject: [PATCH v9 13/13] dm: add power-of-2 target for zoned devices with non power-of-2 zone sizes Date: Wed, 3 Aug 2022 11:48:01 +0200 Message-Id: <20220803094801.177490-14-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220803094801.177490-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCKsWRmVeSWpSXmKPExsWy7djP87oJLq+SDN5M1LNYf+oYs8Xqu/1s FtM+/GS2+H32PLNFa/s3Jou972azWtw8sJPJYs+iSUwWK1cfZbJ4sn4Ws8XfrntA2VvaFpd3 zWGzmL/sKbvFhLavzBafl7awW6y5+ZTF4sQtaQchj8tXvD12zrrL7nH5bKnHplWdbB6bl9R7 7L7ZwOaxs/U+q8f7fVfZPPq2rGL02Hy62uPzJjmP9gPdTAE8UVw2Kak5mWWpRfp2CVwZh3/u YSw4V1hxveUHewPj5qguRk4OCQETialvuli7GLk4hARWMEo8X7eQESQhJPCFUaLtoCtE4jOj xNem7YwwHYebvzJBJJYzSsy4eo8ZwnnJKHF2WgvQLA4ONgEticZOdpC4iEAzo8Tdvz1gO5gF PjNJrNg3kxlklLBAmsTNvoNgNouAqsTSI5/AbF4Ba4kpD04yQ6yTl5h56Ts7iM0JEv/3D6pG UOLkzCcsIDYzUE3z1tlQ9ds5JZoXhEHYLhIvTi1mgrCFJV4d38IOYctI/N85HypeLfH0xm+w DyQEWhgl+neuZwP5QAJoWd+ZHBCTWUBTYv0ufYhyR4mFp3vZISr4JG68FYS4gE9i0rbpzBBh XomONiGIaiWJnT+fQC2VkLjcNIcFwvaQmPa4l30Co+IsJL/MQvLLLIS9CxiZVzGKp5YW56an FhvlpZbrFSfmFpfmpesl5+duYgQm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oFZSFKzkKQW MDKtYhRJLS3OTc8tNtQrTswtLs1L10vOz93ECIzfbcd+bt7BOO/VR71DjEwcjIcYJTiYlUR4 77g8TxLiTUmsrEotyo8vKs1JLT7EaAp090RmKdHkfGACySuJNzQzMDU0MbM0MLU0M1YS5/Us 6EgUEkhPLEnNTk0tSC2C6WPi4JRqYIqcxXm2SFZr77Nsf8fEWsmXS66y+S3cWPU1Rmpth+mN a4cFRVeq3OLRykhYvN8xtiHikdnR77NDYjoE7/78se0k3+evQRvLJv51vphnd/Ry9Fs7PZ1y JtdytyIZpoN7eFJ4+gTV/fdVHj/91XIRz4HDP0sKP8ssDeet/hlfvFHFy68yrP3UpNaXd8K/ 3/g2/+6pGx/2PuoNijLcv91r5+/Le5ZUqe2a9v1+xH0roRfvdh6XTvcVkJlx8/uN3jO+naXz X+y3Z9q3UrOSd6Fe63kOA8fJ6x5PS2w7q+5o11H9YPeG5qMbZDS3yN2ct2War9L6nZP/nTu8 sHsXi7SkqPsLnVsXDu/p+1Kz9kled1S1EktxRqKhFnNRcSIAsAmZAGgDAAA= X-CMS-MailID: 20220803094816eucas1p1890ceb4faebaf4f0cdbc9581d1308672 X-Msg-Generator: CA X-RootMTR: 20220803094816eucas1p1890ceb4faebaf4f0cdbc9581d1308672 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220803094816eucas1p1890ceb4faebaf4f0cdbc9581d1308672 References: <20220803094801.177490-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) zone sizes 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