From patchwork Tue Aug 23 12:18:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 12952132 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 DD703C32772 for ; Tue, 23 Aug 2022 15:07:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241791AbiHWPHv (ORCPT ); Tue, 23 Aug 2022 11:07:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243082AbiHWPHN (ORCPT ); Tue, 23 Aug 2022 11:07:13 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39A2D32A6B6 for ; Tue, 23 Aug 2022 05:36:25 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20220823121917euoutp0116e9534a5a8c4a53110147cb39d0503d~N_JVcbatZ1942519425euoutp01n for ; Tue, 23 Aug 2022 12:19:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20220823121917euoutp0116e9534a5a8c4a53110147cb39d0503d~N_JVcbatZ1942519425euoutp01n 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 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrKKsWRmVeSWpSXmKPExsWy7djPc7qHj7IkG9xvMrJYf+oYs8Xqu/1s FtM+/GS2+H32PLNFa/s3Jou972azWtw8sJPJYs+iSUwWK1cfZbJ4sn4Ws8XfrntA2VvaFpd3 zWGzmL/sKbvFhLavzBafl7awW6y5+ZTF4sQtaQchj8tXvD12zrrL7nH5bKnHplWdbB6bl9R7 7L7ZwOaxs/U+q8f7fVfZPPq2rGL02Hy62uPzJjmP9gPdTAE8UVw2Kak5mWWpRfp2CVwZbWvv shccKqk43n6GpYHxYkwXIyeHhICJxISj89i7GLk4hARWMErcW7gNyvkC5DSvZYNwPjNKfGnq YoNpWfDjLFRiOaPE5T0LGSGcF4wSrTNvsXYxcnCwCWhJNHaygzSICKRLfP26AayGWWAis8S0 200sIAlhoMSs6+9ZQWwWAVWJ2/smMILYvALWEgt3v2KG2CYvMfPSd7BBnEDxeUtPQdUISpyc +QRsDjNQTfPW2cwgCyQENnNKfH56DOpUF4mjhy9D2cISr45vYYewZSROT+5hgbCrJZ7e+A3V 3MIo0b9zPRvIBxJA2/rO5ICYzAKaEut36UOUO0rsX3CeGaKCT+LGW0GIE/gkJm2bDhXmleho E4KoVpLY+fMJ1FIJictNc6CWeki0n3/JPIFRcRaSZ2YheWYWwt4FjMyrGMVTS4tz01OLjfJS y/WKE3OLS/PS9ZLzczc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J2c+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 X-RootMTR: 20220823121915eucas1p10296d6a2ab00de5e73791a7d6b8e39de X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220823121915eucas1p10296d6a2ab00de5e73791a7d6b8e39de References: <20220823121859.163903-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 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