Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3687580rwb; Tue, 16 Aug 2022 07:15:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR5CUsWBShrohFLIH+pn5aU1Fr2wrvh2Jk3+JBEGtGJ2fg2qEnBHakN11JldoVOJ4Df1QUKN X-Received: by 2002:a17:902:7c90:b0:172:5f2a:9e3a with SMTP id y16-20020a1709027c9000b001725f2a9e3amr14830652pll.1.1660659351488; Tue, 16 Aug 2022 07:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660659351; cv=none; d=google.com; s=arc-20160816; b=HHsSVFVjeaEHcW+VzbjQ6Euo8SswmUdnm0uSpaK8VkWdyshhUslFQhP6XxD+7eXWk0 fy4nOW72F/D2d22B/oe2nK90FfPSxCNQLM5TdSfxeL2p8puzco5pozu+b+dKBJ25JfuD b2T8/0XS3YsiYZpvyZUoZYeD5SqrfML6o1IGAjWndpYr9+3q7kA+hli/c1z5CYC32Fi4 pCCnuPDihqQBMHA2eazrdQ7tj8/m4Df7xlubEXKfby7lGDeDcBn0CIXyvflx1JRJsAUs HKnA6IjuYLz5NNKgaje8TkYlpjcY7Vo4WA3wQleBvV6JxZI7EjZoSwtyLoFjP5OxQN91 aXLA== 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=PvnenMuRv4p19PPEMOW1GA5OXgVclqzULdTF9h0TpXk=; b=swUc+rEM0iBw2BKDUQY6tStG0+fnUWc6twwRZhoPNY9kHgYVBwHeNnS8rBeDFR74nt 3lCguRxJ9tNnt5zRKeDRzz0worbw5Qer/m1JbJbXPPaFdf3iBHC3X7sh0JuUWm2fEDEb +VIIbx57aOvNBEyN/Za0EuWhz34i+eZ7ZDeQ1VI2Bmouha0o9PSSffUWSVMQvHhXNRAI Zc+cD+Q2SY2WIx2WowUs7V0EgZh1rRRbpyRI0BCh/VqnP6A8D2NjA6IH7xN/S+3xf/Kh a3TiSOSD/MRnGlEtCkCSN5UiSQY7C7PqKSspd4ZXQAQoDJWuI4xfKzEp88rK+eIfQy/k EmGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Chr9StB+; 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 p10-20020a170902f08a00b0016efa01dfb6si12282571pla.132.2022.08.16.07.15.40; Tue, 16 Aug 2022 07:15:51 -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=Chr9StB+; 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 S235724AbiHPNQ5 (ORCPT + 99 others); Tue, 16 Aug 2022 09:16:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233412AbiHPNP6 (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 F3C6C61D77 for ; Tue, 16 Aug 2022 06:15:54 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20220816131553euoutp022a62968de80649566a3bdac9d0e43342~L1ZwFvcxv2682526825euoutp02a for ; Tue, 16 Aug 2022 13:15:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20220816131553euoutp022a62968de80649566a3bdac9d0e43342~L1ZwFvcxv2682526825euoutp02a 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 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMKsWRmVeSWpSXmKPExsWy7djPc7odM34nGTSvYrRYf+oYs8Xqu/1s FtM+/GS2+H32PLNFa/s3Jou972azWtw8sJPJYs+iSUwWK1cfZbJ4sn4Ws8XfrntA2VvaFpd3 zWGzmL/sKbvFhLavzBafl7awW6y5+ZTF4sQtaQchj8tXvD12zrrL7nH5bKnHplWdbB6bl9R7 7L7ZwOaxs/U+q8f7fVfZPPq2rGL02Hy62uPzJjmP9gPdTAE8UVw2Kak5mWWpRfp2CVwZ1yf0 MRWsKalYuqGugXF/TBc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-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20220816131551eucas1p218faf35348e78a73aaa87d5477ecdb2e X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220816131551eucas1p218faf35348e78a73aaa87d5477ecdb2e References: <20220816131536.189406-1-p.raghav@samsung.com> X-Spam-Status: No, score=-7.1 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 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