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: 12986833 X-Patchwork-Delegate: snitzer@redhat.com 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 us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 05A91C6FA86 for ; Fri, 23 Sep 2022 17:36:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663954606; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=XR1U9IdFQBNp/Mf9eQFVbgNtciKvULor4SnE2CFiawc=; b=b0jWQiw+6Z/bsaoMvnGefunuVRWSxdC7Z/j294K+u+Hd3FZZ920q5PpJY6zlSqAaBj0zCl dEjVPxvzwdoRkx48MCdVV5yM5CSM7yHmtjLjVt3aHq14kYbAipuqGMlL4xZXhSqsNI2esa vUIt0k13U8735r1ZJjB7eea3BsjTzFc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-435-oQ-jipv1OkC3hEEDKVql1w-1; Fri, 23 Sep 2022 13:36:44 -0400 X-MC-Unique: oQ-jipv1OkC3hEEDKVql1w-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B874587A9E9; Fri, 23 Sep 2022 17:36:42 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A4DD849BB60; Fri, 23 Sep 2022 17:36:42 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9943B19465B6; Fri, 23 Sep 2022 17:36:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6E3F519465A4 for ; Fri, 23 Sep 2022 17:36:41 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 62F7C40C2086; Fri, 23 Sep 2022 17:36:41 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5A3A540C2066 for ; Fri, 23 Sep 2022 17:36:41 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 39A05862FF7 for ; Fri, 23 Sep 2022 17:36:41 +0000 (UTC) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-261-S0My0HvxO6GCwpkOT3XsyQ-1; Fri, 23 Sep 2022 13:36:38 -0400 X-MC-Unique: S0My0HvxO6GCwpkOT3XsyQ-1 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20220923173637euoutp02337e98bf4caa3f5a4ca9446c41764f9a~XjePuHhrA3253832538euoutp02Z for ; Fri, 23 Sep 2022 17:36:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20220923173637euoutp02337e98bf4caa3f5a4ca9446c41764f9a~XjePuHhrA3253832538euoutp02Z 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 Date: Fri, 23 Sep 2022 19:36:18 +0200 Message-Id: <20220923173618.6899-14-p.raghav@samsung.com> 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 U4sN81LL9YoTc4tL89L1kvNzNzECU+Hpf8c/7WCc++qj3iFGJg7GQ4wSHMxKIrwpF3WThXhT EiurUovy44tKc1KLDzFK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U4GBWEuFN 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> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Subject: [dm-devel] [PATCH v15 13/13] dm: add power-of-2 target for zoned devices with non power-of-2 zone sizes X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pankaj Raghav , Damien Le Moal , bvanassche@acm.org, pankydev8@gmail.com, gost.dev@samsung.com, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, dm-devel@redhat.com, Johannes Thumshirn , jaegeuk@kernel.org, matias.bjorling@wdc.com Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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