Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3798502rwa; Tue, 23 Aug 2022 10:15:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR6dAk7dcnWZeqe/MXno9zRiD3AUMv438XKUIC36qSCbVhgMWnuJK0zrcnN8swzzxXkeGoL1 X-Received: by 2002:a05:6402:5201:b0:446:cfe7:9f0c with SMTP id s1-20020a056402520100b00446cfe79f0cmr4491671edd.16.1661274937445; Tue, 23 Aug 2022 10:15:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661274937; cv=none; d=google.com; s=arc-20160816; b=0PZNctGGXedYqz0QQbwuXy6Z7vlmqlCZKVbEvpsLQlBX4LgKLeUztFZpNl1YK+1CPv twmIal48eJNtd0XCnsUXGFR2OI5Ct3xLS7u9tOFAB3225AtPwQIHx5AB+o/zHLOoZTgm 66mWZkahDyFk8SYd9JXwCJIG20Vj0sMPmPmYUXqnJhhBe6/lu8Du9ebCKD5o5FQYVLEf 6TI9QMb3HV04vwN6tUFCwCJQP+PpBoBacq0Aamy4KKg+Ot25/0MKO90qRl8XWGbkkmX0 UD6d4pNgqoFnE6xubLSkw9HwJ6TgoBsb4P+mn6tEJkkyqlAXhip1W3vgtGj8TJfEK28Y 1vbw== 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=mhKQkm9LhOUOVE6sXJgtCRLsxg1oLWb8jLetO1EFBXU=; b=DrXr5loqpfw1S764pEQY4TuIkXyr/1dFxfEQtgzTksc9z6bLh+q76da+GNQa4YqYGD K/xot532a3900bH6aalvhAkqvQcxRFrm0U3zSdt3szXngYUCBP47CiEzsLtWRFJrB8ok S1uq4lNmtJ18agP2Vg3BShpZXgJIF3PzCri5Fk1zqXOSaUrlfTOhZeZ7ohjAUq8A0ndQ y3tISUn9uf4vgq240Wq6YfvLKxxNSQJM1IKwEqpAg/POPn/7GmRlt8cSBxCbAw4IJz0T PBd5IicFSu2W1pANKWifD1ljeSftUd7rKuHr1UwEkD8q+8dYPVy/4gCOtVgIOo3/56MP f8bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=e3pKrF2t; 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 p2-20020a170906b20200b007306dde08desi163771ejz.448.2022.08.23.10.15.11; Tue, 23 Aug 2022 10:15:37 -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=e3pKrF2t; 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 S244443AbiHWQRb (ORCPT + 99 others); Tue, 23 Aug 2022 12:17:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244598AbiHWQQn (ORCPT ); Tue, 23 Aug 2022 12:16:43 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86337106519 for ; Tue, 23 Aug 2022 05:37:49 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20220823121917euoutp025b873f0f0d515d3cad0c29abbde3837e~N_JVccX_12224122241euoutp02S for ; Tue, 23 Aug 2022 12:19:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20220823121917euoutp025b873f0f0d515d3cad0c29abbde3837e~N_JVccX_12224122241euoutp02S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1661257157; bh=mhKQkm9LhOUOVE6sXJgtCRLsxg1oLWb8jLetO1EFBXU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e3pKrF2tJFdaT4M1uVzn+2LAnPgoCaOaa7OgQ1hbnuyVegyQxROEkhgXLJhsd9Gdl ybFntQQpWYkUyrS0ltzi50b2vT99d6byBiPW7cT3xNHLXqKTNsl3JDDN9jfDAAHuZY 0ocif7/jt2UMn+dTJ5rbZW8oYQCKakZVxPGhxTV0= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20220823121915eucas1p231640ad5e7f8ec5252be3cc2c8cd9b7a~N_JTiAgiD2416724167eucas1p2W; Tue, 23 Aug 2022 12:19:15 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 75.81.07817.3C5C4036; Tue, 23 Aug 2022 13:19:15 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20220823121915eucas1p10296d6a2ab00de5e73791a7d6b8e39de~N_JS8cGJv1882118821eucas1p1c; Tue, 23 Aug 2022 12:19:15 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220823121915eusmtrp1e7eaddb67677c16e1ef95c0060c64f9e~N_JS7k_NJ1042010420eusmtrp1Q; Tue, 23 Aug 2022 12:19:15 +0000 (GMT) X-AuditID: cbfec7f4-893ff70000011e89-81-6304c5c35beb Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 49.81.10862.3C5C4036; Tue, 23 Aug 2022 13:19:15 +0100 (BST) Received: from localhost (unknown [106.210.248.52]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220823121914eusmtip2c71e3c24e4f992e4008983a29b4f3900~N_JShQGib1590015900eusmtip2M; Tue, 23 Aug 2022 12:19:14 +0000 (GMT) From: Pankaj Raghav To: agk@redhat.com, snitzer@kernel.org, axboe@kernel.dk, damien.lemoal@opensource.wdc.com, hch@lst.de Cc: pankydev8@gmail.com, Johannes.Thumshirn@wdc.com, linux-block@vger.kernel.org, dm-devel@redhat.com, hare@suse.de, jaegeuk@kernel.org, linux-kernel@vger.kernel.org, matias.bjorling@wdc.com, gost.dev@samsung.com, bvanassche@acm.org, linux-nvme@lists.infradead.org, Pankaj Raghav , Johannes Thumshirn , Damien Le Moal Subject: [PATCH v12 13/13] dm: add power-of-2 target for zoned devices with non power-of-2 zone sizes Date: Tue, 23 Aug 2022 14:18:59 +0200 Message-Id: <20220823121859.163903-14-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220823121859.163903-1-p.raghav@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrKKsWRmVeSWpSXmKPExsWy7djPc7qHj7IkG9xvMrJYf+oYs8Xqu/1s FtM+/GS2+H32PLNFa/s3Jou972azWtw8sJPJYs+iSUwWK1cfZbJ4sn4Ws8XfrntA2VvaFpd3 zWGzmL/sKbvFhLavzBafl7awW6y5+ZTF4sQtaQchj8tXvD12zrrL7nH5bKnHplWdbB6bl9R7 7L7ZwOaxs/U+q8f7fVfZPPq2rGL02Hy62uPzJjmP9gPdTAE8UVw2Kak5mWWpRfp2CVwZbWvv shccKqk43n6GpYHxYkwXIyeH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P0sZou/XfeAsre0LS7v msNmMX/ZU3aLCW1fmS0+L21ht1hz8ymLxYlb0g5CHpeveHvsnHWX3ePy2VKPTas62Tw2L6n3 2H2zgc1jZ+t9Vo/3+66yefRtWcXosfl0tcfnTXIe7Qe6mQJ4ovRsivJLS1IVMvKLS2yVog0t jPQMLS30jEws9QyNzWOtjEyV9O1sUlJzMstSi/TtEvQy2tbeZS84VFJxvP0MSwPjxZguRk4O CQETiQU/zrKB2EICSxkl1u9Xg4hLSNxe2MQIYQtL/LnWBVTDBVTzjFGi79Qfpi5GDg42AS2J xk52kBoRgVyJw5snMIHUMAssZJaY/a2LBSQhLJAq8WnTUWYQm0VAVeL2vglgQ3kFrCUW7n7F DLFAXmLmpe9ggziB4vOWnmKEOMhKYv6tT2wQ9YISJ2c+AZvJDFTfvHU28wRGgVlIUrOQpBYw Mq1iFEktLc5Nzy020itOzC0uzUvXS87P3cQIjN1tx35u2cG48tVHvUOMTByMhxglOJiVRHir LzIkC/GmJFZWpRblxxeV5qQWH2I0Bbp7IrOUaHI+MHnklcQbmhmYGpqYWRqYWpoZK4nzehZ0 JAoJpCeWpGanphakFsH0MXFwSjUwTY08/vTjqpbkwDl3D+3tNLTQFbx9S9KI5ew2hYnJ89xs rh5lkeN1FpU6p7LAKKv0+zt7H7v0mVZWWnpRQb4/W9ybnW1f28/bupPHiMf23jKF2rnrHjJ8 3TTRKXlyNUdg5crPKgy7/v5juVCXuIox4X36x3s91/d89q1SkbNbseZsXoPhfq7/d4MNmdzv hf/xXmV/dc/+wCVeCyv0E77OS//cx3Vq3uS+S9+a27/KBIblnBb5e/qjCVf4b02ppjtTlE/e K96WfaWuN9uDtzv3tpDQrilb7nUK7nn3umdnSkdwjEzI2mVRUsIlhtseObecOX9za+AkF8lU rc7v8Wb7ZzdauHxQYS7PuH//xoybSizFGYmGWsxFxYkAgbScY2YDAAA= X-CMS-MailID: 20220823121915eucas1p10296d6a2ab00de5e73791a7d6b8e39de X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20220823121915eucas1p10296d6a2ab00de5e73791a7d6b8e39de X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220823121915eucas1p10296d6a2ab00de5e73791a7d6b8e39de References: <20220823121859.163903-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=unavailable 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