From patchwork Tue Aug 16 13:15:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 12944924 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 11B79C25B0E for ; Tue, 16 Aug 2022 13:16:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235604AbiHPNQX (ORCPT ); Tue, 16 Aug 2022 09:16:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235603AbiHPNP6 (ORCPT ); Tue, 16 Aug 2022 09:15:58 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9693162A9A for ; Tue, 16 Aug 2022 06:15:55 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20220816131553euoutp02f8def4855aae45f838daeb0107a26960~L1ZwKFUmJ2682126821euoutp02S for ; Tue, 16 Aug 2022 13:15:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20220816131553euoutp02f8def4855aae45f838daeb0107a26960~L1ZwKFUmJ2682126821euoutp02S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1660655753; bh=PvnenMuRv4p19PPEMOW1GA5OXgVclqzULdTF9h0TpXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Chr9StB+BuLCOZziSJvQFNcAbac7bnxFyktdQdTage+kX7iuSqRdEer5fQGfkvFx9 pvhOrv9jHAgW5+8DdtZUBozaDUQJN+6a8xUdmqsqsi5WgW1mMLCYRp0e7UQ/xXbMa+ GQbaKc3MDdn8yVdH8Oh4STKolwFhusk0tCQwJx7E= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20220816131552eucas1p1709a353975f87319714174c850fd7b1d~L1ZunC-aD0140201402eucas1p1f; Tue, 16 Aug 2022 13:15:52 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id AC.75.09580.7889BF26; Tue, 16 Aug 2022 14:15:52 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20220816131551eucas1p218faf35348e78a73aaa87d5477ecdb2e~L1ZuLzZAy2105421054eucas1p2Y; Tue, 16 Aug 2022 13:15:51 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220816131551eusmtrp1815fdc7c94e0639069a8d54ef394dfd4~L1ZuLA3xS0149801498eusmtrp1U; Tue, 16 Aug 2022 13:15:51 +0000 (GMT) X-AuditID: cbfec7f5-9adff7000000256c-02-62fb98871665 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 4E.B0.09095.7889BF26; Tue, 16 Aug 2022 14:15:51 +0100 (BST) Received: from localhost (unknown [106.210.248.74]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220816131551eusmtip2e31148a6f0507b64d252ad661f155c16~L1Zt06k2_1196811968eusmtip2e; Tue, 16 Aug 2022 13:15:51 +0000 (GMT) From: Pankaj Raghav To: damien.lemoal@opensource.wdc.com, axboe@kernel.dk, snitzer@kernel.org, hch@lst.de, agk@redhat.com Cc: pankydev8@gmail.com, gost.dev@samsung.com, matias.bjorling@wdc.com, hare@suse.de, bvanassche@acm.org, linux-kernel@vger.kernel.org, dm-devel@redhat.com, linux-nvme@lists.infradead.org, jaegeuk@kernel.org, Johannes.Thumshirn@wdc.com, linux-block@vger.kernel.org, Pankaj Raghav , Johannes Thumshirn , Damien Le Moal Subject: [PATCH v11 13/13] dm: add power-of-2 target for zoned devices with non power-of-2 zone sizes Date: Tue, 16 Aug 2022 15:15:36 +0200 Message-Id: <20220816131536.189406-14-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220816131536.189406-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMKsWRmVeSWpSXmKPExsWy7djPc7odM34nGTSvYrRYf+oYs8Xqu/1s FtM+/GS2+H32PLNFa/s3Jou972azWtw8sJPJYs+iSUwWK1cfZbJ4sn4Ws8XfrntA2VvaFpd3 zWGzmL/sKbvFhLavzBafl7awW6y5+ZTF4sQtaQchj8tXvD12zrrL7nH5bKnHplWdbB6bl9R7 7L7ZwOaxs/U+q8f7fVfZPPq2rGL02Hy62uPzJjmP9gPdTAE8UVw2Kak5mWWpRfp2CVwZ1yf0 MRWsKalYuqGugXF/TBcjJ4eEgIlE1/W5zF2MXBxCAisYJQ4uucwE4XxhlOiYf5QVwvnMKPF/ 9UtGmJbn039BJZYzStxfsoYdwnnBKDFzyjeWLkYODjYBLYnGTnaQBhGBdIkpLS9ZQGxmgYnM EtNmpIDYwkDxadc2s4HYLAKqEl0/FoEt4BWwlmj9dIQVYpm8xMxL38HmcALF/zWsYoGoEZQ4 OfMJ1Ex5ieats8F+kBBYzymx8tcHdohmF4lfn68xQdjCEq+Ob4GKy0icntzDAmFXSzy98Ruq uYVRon/nejaQBySAtvWdyQExmQU0Jdbv0ocod5TYcO0LC0QFn8SNt4IQJ/BJTNo2nRkizCvR 0SYEUa0ksfPnE6ilEhKXm+ZALfWQ+NiwjH0Co+IsJM/MQvLMLIS9CxiZVzGKp5YW56anFhvn pZbrFSfmFpfmpesl5+duYgSmw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CkpqFJLWAkWkV o0hqaXFuem6xoV5xYm5xaV66XnJ+7iZGYORuO/Zz8w7Gea8+6h1iZOJgPMQowcGsJMIr+OJH khBvSmJlVWpRfnxRaU5q8SFGU6C7JzJLiSbnA1NHXkm8oZmBqaGJmaWBqaWZsZI4r2dBR6KQ QHpiSWp2ampBahFMHxMHp1QDk1NX+J26WPXiOOvFjMcXrGPg8vFf/7Q/VCe2Sn5HpHrRXNsV D2W2+jSVFDdciV1UUuuuHfDi1f4lQTptnPvvLf/qHhoY/DrAdU3gji726Kbz7i9yH+TsTdA0 b2WsMe9nNpq+L/LUi2O6K0/M+34+zlVvxzGuVof51w7oN0XVhJY0t1VaNc22Kqvi9RT7Zma2 cP/lectXsXJM6V8nEGUUtWn/MlPbX7s82/cYVsw3Dk3i4/cLcXUV3GPl9C3uRsn6GRNYSwWu pQkuvWV24qfOk0mfnRKnxXgZ7D9n2tA1/8cb+633ot3Xh97ZqPTq86sSp0zRhWKXTnAsPLLF asHs2/vdE/cEZe3ax/aitJVLiaU4I9FQi7moOBEA7hQFAWUDAAA= X-CMS-MailID: 20220816131551eucas1p218faf35348e78a73aaa87d5477ecdb2e X-Msg-Generator: CA X-RootMTR: 20220816131551eucas1p218faf35348e78a73aaa87d5477ecdb2e X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220816131551eucas1p218faf35348e78a73aaa87d5477ecdb2e References: <20220816131536.189406-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 zone size 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 value. 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