From patchwork Fri Sep 23 17:36:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 12986847 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 3140AC04A95 for ; Fri, 23 Sep 2022 17:37:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232519AbiIWRhh (ORCPT ); Fri, 23 Sep 2022 13:37:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232336AbiIWRhS (ORCPT ); Fri, 23 Sep 2022 13:37:18 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84737153A5F for ; Fri, 23 Sep 2022 10:36:39 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20220923173637euoutp01e67ec0e1da0f0ea87fc79878b41c4834~XjePuG6nS1803218032euoutp01T for ; Fri, 23 Sep 2022 17:36:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20220923173637euoutp01e67ec0e1da0f0ea87fc79878b41c4834~XjePuG6nS1803218032euoutp01T DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1663954597; bh=ejhVj2g5QfJG/lRSOPvtvchuAqj5y4NFP968qKAMySY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HGpeOo2hCjqZ9PcAYq1A57aM+3ND0txF+EfsW6smymjJgud4QssTnH1shqcMNW+Bt Yv/ZsaRYtDrYsKwgwHfDMWW6LECWgPLBMUv5YUIMGgUXOdDHKMHRlijB6UGdPctK8z jh43DS5LKa7PJ272FrltmZZA4ibobvPJpcKxUHmA= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20220923173635eucas1p1012b2a34974b634fd508b49151c8f749~XjeN9sEbZ1392113921eucas1p1O; Fri, 23 Sep 2022 17:36:35 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 7F.6E.29727.3AEED236; Fri, 23 Sep 2022 18:36:35 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20220923173634eucas1p18fccee11155c670354da389b4d2f4c60~XjeMrPz061389413894eucas1p1M; Fri, 23 Sep 2022 17:36:34 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220923173634eusmtrp2085269d5b93f72f25da920ed225641b9~XjeMqcR-y1023410234eusmtrp2A; Fri, 23 Sep 2022 17:36:34 +0000 (GMT) X-AuditID: cbfec7f2-205ff7000001741f-3b-632deea3a07a Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 0E.5F.10862.1AEED236; Fri, 23 Sep 2022 18:36:34 +0100 (BST) Received: from localhost (unknown [106.210.248.168]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220923173633eusmtip28b3fca191f74d1d4ca1c403f983a9307~XjeMSQMwF2194521945eusmtip2h; Fri, 23 Sep 2022 17:36:33 +0000 (GMT) From: Pankaj Raghav To: snitzer@kernel.org, axboe@kernel.dk, agk@redhat.com, hch@lst.de, damien.lemoal@opensource.wdc.com Cc: jaegeuk@kernel.org, gost.dev@samsung.com, bvanassche@acm.org, linux-kernel@vger.kernel.org, hare@suse.de, matias.bjorling@wdc.com, Johannes.Thumshirn@wdc.com, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, pankydev8@gmail.com, dm-devel@redhat.com, Pankaj Raghav , Johannes Thumshirn , Damien Le Moal Subject: [PATCH v15 13/13] dm: add power-of-2 target for zoned devices with non power-of-2 zone sizes Date: Fri, 23 Sep 2022 19:36:18 +0200 Message-Id: <20220923173618.6899-14-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220923173618.6899-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrIKsWRmVeSWpSXmKPExsWy7djP87qL3+kmGzx8Jm2x/tQxZovVd/vZ LKZ9+Mls8fvseWaL1vZvTBZ7381mtbh5YCeTxZ5Fk5gsVq4+ymTxZP0sZou/XfeAsre0LS7v msNmMX/ZU3aLCW1fmS0+L21ht1hz8ymLxYlb0g5CHpeveHvsnHWX3ePy2VKPTas62Tw2L6n3 2H2zgc1jZ+t9Vo/3+66yefRtWcXosfl0tcfnTXIe7Qe6mQJ4orhsUlJzMstSi/TtErgy3t79 wFKwv77iwK47rA2Mc1K7GDk5JARMJM6sOcjYxcjFISSwglFixYEjLBDOF0aJpiPrGUGqhAQ+ M0rMfaXRxcgB1rF1TiVEzXJGiZ47P6AaXjJKvPvwnA2kiE1AS6Kxkx2kV0QgXeL41pvsIDXM AhOZJZ5uvg2WEAZKfH4/lQXEZhFQlViwbCrYMl4BS4k1m5ayQpwnLzHz0nd2kJmcQPH+xhqI EkGJkzOfgLUyA5U0b53NDDJfQmAzp8SFzbvZIA51kbj3iAtijLDEq+Nb2CFsGYn/O+czQdjV Ek9v/IbqbWGU6N+5HqrXWqLvTA6IySygKbF+lz5EuaNE36VVrBAVfBI33gpCXMAnMWnbdGaI MK9ER5sQRLWSxM6fT6CWSkhcbprDAmF7SNzY0cs8gVFxFpJfZiH5ZRbC3gWMzKsYxVNLi3PT U4sN81LL9YoTc4tL89L1kvNzNzEC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USS1tDg3PbfYSK84Mbe4NC9dLzk/dxMjMHK3Hfu5ZQfjylcf9Q4xMnEwHmKU4GBWEuFN uaibLMSbklhZlVqUH19UmpNafIjRFOjsicxSosn5wNSRVxJvaGZgamhiZmlgamlmrCTO61nQ kSgkkJ5YkpqdmlqQWgTTx8TBKdXApHjR7FaCtHeY9NEJfNvkZhzIY7/7OP9x2O2ex/y3NGz/ 7Fp9rH5TVM3O9LLSV9cFajOZqrwW3GsP3CXXHNB7wvhzset8+8BfNxfYRZaFnn/+r55pUhyb Zf7m/SkyfbUJ6w5LVh2sbmk7eCbKl0EvtCrpUMFeN/8J32btjvP4Z8+1ZIbn6biN16T+/L/9 tGBnbMY2S9mMKcesolMvhGa0zVl0zLR9stK+P2lFNSfu3U/b9vGBRrH7jPsfJFZfripf3d6R k/O0efqWDROuJX/f2/H1d4SjxtSJ3dMuB0mLil+eUVHN3XGiVFR+2gavlS/7dh49F+TAvVY9 d7nZ728Xp7XubT/16Ow5161Zy9Ts4pRYijMSDbWYi4oTAQhmqjplAwAA X-CMS-MailID: 20220923173634eucas1p18fccee11155c670354da389b4d2f4c60 X-Msg-Generator: CA X-RootMTR: 20220923173634eucas1p18fccee11155c670354da389b4d2f4c60 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220923173634eucas1p18fccee11155c670354da389b4d2f4c60 References: <20220923173618.6899-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. 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