Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp646870rwb; Thu, 11 Aug 2022 07:42:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR6A0nY3Dj39uE7HBnC0CM/R7v8NTqXKFWWPM7D31uTLQxVi5KDHnj9V3DEpmfReTTmnlS8J X-Received: by 2002:a17:902:e5cf:b0:171:4f8d:228e with SMTP id u15-20020a170902e5cf00b001714f8d228emr1404923plf.99.1660228962083; Thu, 11 Aug 2022 07:42:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660228962; cv=none; d=google.com; s=arc-20160816; b=RhKFL1+Hp84GVa01rNcOlo9Amd1qbr0eaOJrUihVp2+pyR0pnoP2ifplkAyBPcNtwG 49M21Xfl3uakamj5u+GpNvk+l8nFinM+xmno6sU/j49LyY2mjblFps0fTYq2859BOMLo lTSl4LMWyTpQoivSAhM81/hWPY7llj/uj70Jh719a0tO7EKuyiUfurl3SBX9Ux9gH1nQ D05pc8jtylZAYTzy11S+nF/su2ePjHkcj22VlSPQNF2Z1R2n+7H5mDKb4sMuXnbncLSO TDAYb1QgIJf/2jWXNEF/AophKlks15LnH6O80NMHiu3DVjdQJA/D+8fENRb5d0zdtBMv owGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :mime-version:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=IUoyViCkp3U4Q2I4KlB9fJBiLbxoRuZRmvXdr8vBKuU=; b=RdpgCNB6Q3nMiEgKNzgz/FDyyuI6TEItXfrOljXgqu2YoNwNosB0XsDJgoTq4yFBDo rnJ1iUJZfxI1+E7aPrHSvpBvfR7TgPrpQugpnba1rvU1bbEI/Od0jlu3v1QPqSpLN0ME 6Cyfe4gV/vENSRutFI9tKIKyjMF1gsknWlMEQeRsoudhgevdAwTu+EhSvnA7/7KSaouJ vxSD2vOtWkQkaHWeR2vmrpnGPAi5aoWfNX0LSyXSuS+hKHWXDYIQIg7Ag9sDU1VZOvMx KDAm3H8VuGZPcMTGUpgz6B+VQ64+A31Vml2Mo1V8Cjt4MI4arICAzweICXC1ZByIJa1P z8Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=E5mnu1ZU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y16-20020a056a00191000b0052de95aebb4si5891983pfi.158.2022.08.11.07.42.27; Thu, 11 Aug 2022 07:42:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=E5mnu1ZU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235692AbiHKOcF (ORCPT + 99 others); Thu, 11 Aug 2022 10:32:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235544AbiHKObE (ORCPT ); Thu, 11 Aug 2022 10:31:04 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0661D647FA for ; Thu, 11 Aug 2022 07:31:03 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20220811143101euoutp0129ee32f3284a04645e6d94faef252017~KUM7Tw3UA2629226292euoutp01C for ; Thu, 11 Aug 2022 14:31:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20220811143101euoutp0129ee32f3284a04645e6d94faef252017~KUM7Tw3UA2629226292euoutp01C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1660228261; bh=IUoyViCkp3U4Q2I4KlB9fJBiLbxoRuZRmvXdr8vBKuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E5mnu1ZU8jhMXs7D+vSKNJsr68tpM3M8oXucQZ2iQUMgbQXrVnAHwTeyU3sYCkuFW EFxt6sGPcLduFfkNG6GLwcSZoVBF4aB9SOTkFcmXz5EW+17lP2qTeDlZ2agio1oo4J bQGtLGHVi/q62pNljs+JGU58AGMDq+fPmKzFZ8yw= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20220811143059eucas1p1e317135f18477c5d913e987c19bcbcbe~KUM5Yg33T1847718477eucas1p1N; Thu, 11 Aug 2022 14:30:59 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 3D.3A.09664.3A215F26; Thu, 11 Aug 2022 15:30:59 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20220811143058eucas1p247291685ffff7a75186947fd30b5c13f~KUM4hWTb42359623596eucas1p2O; Thu, 11 Aug 2022 14:30:58 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220811143058eusmtrp28f9fb8f8a36160410731318772fa88f6~KUM4gZwt30788907889eusmtrp22; Thu, 11 Aug 2022 14:30:58 +0000 (GMT) X-AuditID: cbfec7f2-d97ff700000025c0-15-62f512a3e869 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 89.9F.09095.2A215F26; Thu, 11 Aug 2022 15:30:58 +0100 (BST) Received: from localhost (unknown [106.210.248.43]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220811143058eusmtip172ed3770e81c435d3d628314002e940f~KUM4IHz2d1917919179eusmtip1b; Thu, 11 Aug 2022 14:30:58 +0000 (GMT) From: Pankaj Raghav To: snitzer@kernel.org, axboe@kernel.dk, hch@lst.de, agk@redhat.com, damien.lemoal@opensource.wdc.com Cc: linux-block@vger.kernel.org, Johannes.Thumshirn@wdc.com, bvanassche@acm.org, matias.bjorling@wdc.com, hare@suse.de, gost.dev@samsung.com, linux-nvme@lists.infradead.org, jaegeuk@kernel.org, pankydev8@gmail.com, linux-kernel@vger.kernel.org, dm-devel@redhat.com, Pankaj Raghav , Johannes Thumshirn , Damien Le Moal , Joel Granados Subject: [PATCH v10 13/13] dm: add power-of-2 target for zoned devices with non power-of-2 zone sizes Date: Thu, 11 Aug 2022 16:30:43 +0200 Message-Id: <20220811143043.126029-14-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220811143043.126029-1-p.raghav@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrFKsWRmVeSWpSXmKPExsWy7djPc7qLhb4mGUy5p2ux/tQxZovVd/vZ LKZ9+Mls8fvseWaL1vZvTBZ7381mtbh5YCeTxZ5Fk5gsVq4+ymSxdP9DRosn62cxW/ztugdU ckvb4vKuOWwW85c9ZbeY0PaV2eLz0hZ2izU3n7JYnLgl7SDscfmKt8fOWXfZPS6fLfXYtKqT zWPzknqP3Tcb2Dx2tt5n9Xi/7yqbR9+WVYwem09Xe3zeJOfRfqCbKYAnissmJTUnsyy1SN8u gStj0/dJbAXHiyumzlzN3MDYEtPFyMkh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P9DRosn62cxW/ztugdU ckvb4vKuOWwW85c9ZbeY0PaV2eLz0hZ2izU3n7JYnLgl7SDscfmKt8fOWXfZPS6fLfXYtKqT zWPzknqP3Tcb2Dx2tt5n9Xi/7yqbR9+WVYwem09Xe3zeJOfRfqCbKYAnSs+mKL+0JFUhI7+4 xFYp2tDCSM/Q0kLPyMRSz9DYPNbKyFRJ384mJTUnsyy1SN8uQS9j0/dJbAXHiyumzlzN3MDY EtPFyMkhIWAiceTZBfYuRi4OIYGljBI3p7SyQSQkJG4vbGKEsIUl/lzrYoMoesYo8fb9EeYu Rg4ONgEticZOdhBTRCBX4uCRQJASZoHTzBINPSdYQHqFBVIl3s4+wApiswioSvz8vYEJxOYV sJa4Me0aE8R8eYmZl76zg9icQPEJiy6CxYUErCQmdBxjh6gXlDg58wnYTGag+uats5knMArM QpKahSS1gJFpFaNIamlxbnpusaFecWJucWleul5yfu4mRmAUbzv2c/MOxnmvPuodYmTiYDzE KMHBrCTCW7boc5IQb0piZVVqUX58UWlOavEhRlOguycyS4km5wPTSF5JvKGZgamhiZmlgaml mbGSOK9nQUeikEB6YklqdmpqQWoRTB8TB6dUA5O2mKLIlXXfDO233PinFl6ySHlnjM2O7Ozf K7qPic2pPvdYNlvsSW3PvTNt76vXncjtXW3mv9NePGf/J/XXqbO/Cm1mlJzhHmCw/SRnxYf4 2LYz3j980i8YvNuVW7anTVG/QL6KkZ8z9tz+lefXsdZ2LLn7RlOc4Wyfl6zP/zhBRU6Vw6VF qWeTz2Sw32HoOH9iobxdpF9U81kl0Sp7013cV6wnzdV+cYB9ZpXPKcdW3dfaR/5EqNnN7Zoe cOtpx+2EdUt8WW6q8icLCF1OMpUoM711WzdH/f1eBpEEK9afHMGvRPyPtBa/Y23cM+93Xr7e 5rftJh1frnr9OrhvxZ0M5TUTFnUtfuw3z/F+mhJLcUaioRZzUXEiACsf2JRrAwAA X-CMS-MailID: 20220811143058eucas1p247291685ffff7a75186947fd30b5c13f X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20220811143058eucas1p247291685ffff7a75186947fd30b5c13f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220811143058eucas1p247291685ffff7a75186947fd30b5c13f References: <20220811143043.126029-1-p.raghav@samsung.com> X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 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