Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp263954imn; Wed, 3 Aug 2022 02:53:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR43SPwF6jVZn7NrfgbohXrRKP0gqpnItYPZ2Ut6+/1o6rvRZIemagqnia7rOEmxrqISSnVz X-Received: by 2002:a17:907:1dee:b0:730:b7d9:626 with SMTP id og46-20020a1709071dee00b00730b7d90626mr1041320ejc.135.1659520430249; Wed, 03 Aug 2022 02:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659520430; cv=none; d=google.com; s=arc-20160816; b=alBAWdlrT+SITX5z7HRyUdhgbMJ0jicVDUfoiQmoGXEBWz37nxhhusFY41OrxumhM0 Limx3xU4d1G7lAAzo/B2zICalqb8qXaGUDVhBtdOlkVhsKFdsqdWXdwnqOkoX2RWAi9Z BHPeyyCNdEWBrjLbLZgETBdqfvGf6E4/7YYfpwwS4WH5OI1o7Ay8/nGVdhqR9p9bi4S5 30DeVKHAJbBVkm0uckoNYjOHBmn2xW7WT8dg7+uqhSGvrK+nPFjaNjJebDzPEmcBT4Qr jUuo+CSCKNrL0K+4Uve/PhOlaAVQS8AOX6VrKQp1v8pyHtQMUBDFszODm88IhyPxW+0r T1Eg== 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=aEZ9MVfXnixWs6H2frFA0ZxvwrL43KBWv8pJqvNry+8=; b=VwrZrgf9VZeZtKIWFKBikAiFUBsgxikI/sKBEdCCL4ImI5aoX2l9ORmMfrIVhUb6/j juNFIWHGcw87iNJgd0gjbvjcm4BwtPl0XXF8QkLSG1RJh0lMviDkHA/Sy1fuBm0utn9I oO5pbU06uL/fJVHDWCp2gFzuVRgN3wE/ysqfow29/a4BNtdyNYlIigjJ28YNRRaARrsC g0zWiHYI+mX3A9OF2ZcCwPO4vkarH0XmOYQPpDZlQs3ma2stUFllCxsTlJGTbD5EhgVE c0X1t+PHxbXUyf9KHuwLabO/kHifrvpwNYYBJmibJy8Pglj9GBLz03fDxSH8p2hwu/No U/8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=SX6hi0cj; 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 g9-20020a1709065d0900b007309e7c7d55si5309750ejt.157.2022.08.03.02.53.24; Wed, 03 Aug 2022 02:53:50 -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=SX6hi0cj; 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 S230417AbiHCJtS (ORCPT + 99 others); Wed, 3 Aug 2022 05:49:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237598AbiHCJsZ (ORCPT ); Wed, 3 Aug 2022 05:48:25 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4C4A58B7C for ; Wed, 3 Aug 2022 02:48:18 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20220803094817euoutp0155f89085f454c1b1e3956d460c8769ff~HzLx49B5g0037100371euoutp01C for ; Wed, 3 Aug 2022 09:48:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20220803094817euoutp0155f89085f454c1b1e3956d460c8769ff~HzLx49B5g0037100371euoutp01C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659520097; bh=aEZ9MVfXnixWs6H2frFA0ZxvwrL43KBWv8pJqvNry+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SX6hi0cjpqpAsjLjSUz4UsZqYJ6G4DfLvJPSV+1Qb2wBrnvxwxA6i0h9cYlItEXxv wPUV++0qXayyvUzuP+dloHz4HAA7e77pGbChcycHUpaPn0jP6LWW7KsCudmSY8iOaq b0OehLT19PH51gu4SAT20h0eUc0U82UjuvBHi3E0= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20220803094815eucas1p1bd55c673d1b14f80f9ba075b862f4c30~HzLwNksfA3109731097eucas1p1c; Wed, 3 Aug 2022 09:48:15 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 2D.06.10067.F544AE26; Wed, 3 Aug 2022 10:48:15 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20220803094815eucas1p2dfab477daf4f2eb05342d756fdf7f14d~HzLvvi38C1528815288eucas1p2r; Wed, 3 Aug 2022 09:48:15 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220803094815eusmtrp12a4dd3bd318933996e4c815d9bdf1bd0~HzLvuqSpX2000320003eusmtrp1o; Wed, 3 Aug 2022 09:48:15 +0000 (GMT) X-AuditID: cbfec7f4-dc1ff70000002753-69-62ea445fd98a Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id EE.9B.09038.F544AE26; Wed, 3 Aug 2022 10:48:15 +0100 (BST) Received: from localhost (unknown [106.210.248.112]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220803094814eusmtip145d6ac2a5c84936e935c88f18387aeec~HzLvY-4Yi2555925559eusmtip1m; Wed, 3 Aug 2022 09:48:14 +0000 (GMT) From: Pankaj Raghav To: Johannes.Thumshirn@wdc.com, snitzer@kernel.org, axboe@kernel.dk, damien.lemoal@opensource.wdc.com, agk@redhat.com, hch@lst.de Cc: dm-devel@redhat.com, matias.bjorling@wdc.com, gost.dev@samsung.com, linux-kernel@vger.kernel.org, pankydev8@gmail.com, jaegeuk@kernel.org, hare@suse.de, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, bvanassche@acm.org, Pankaj Raghav Subject: [PATCH v9 12/13] dm: introduce DM_EMULATED_ZONES target type Date: Wed, 3 Aug 2022 11:48:00 +0200 Message-Id: <20220803094801.177490-13-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220803094801.177490-1-p.raghav@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPKsWRmVeSWpSXmKPExsWy7djP87rxLq+SDD7f0LRYf+oYs8Xqu/1s FtM+/GS2+H32PLPF3nezWS1uHtjJZLFn0SQmi5WrjzJZPFk/i9nib9c9Jou9t7QtLu+aw2Yx f9lTdosJbV+ZLT4vbWG3WHPzKYvFiVvSDoIel694e+ycdZfd4/LZUo9NqzrZPDYvqffYfbOB zWNn631Wj/f7rrJ59G1Zxeix+XS1x+dNch7tB7qZAniiuGxSUnMyy1KL9O0SuDK+vV7LUnBM tOLWkQOsDYztQl2MHBwSAiYSt/7ldzFycQgJrGCU2PvvGjOE84VR4siDbWwQzmdGibnXVrH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e+ycdZfd4/LZUo9NqzrZPDYvqffYfbOB zWNn631Wj/f7rrJ59G1Zxeix+XS1x+dNch7tB7qZAnii9GyK8ktLUhUy8otLbJWiDS2M9Awt LfSMTCz1DI3NY62MTJX07WxSUnMyy1KL9O0S9DK+vV7LUnBMtOLWkQOsDYztQl2MHBwSAiYS e1cEdDFycQgJLGWUOHFrOVMXIydQXELi9sImRghbWOLPtS42iKLnjBLzjz1nAmlmE9CSaOxk B4mLCHQzSlw+c44VxGEWWMYk0fTlOhtIt7CAq8T+ppPsIDaLgKrE+1OfwGxeAWuJU2cvs0Bs kJeYeek7WJwTKD7l3z9mEFtIwEpi3d9ZrBD1ghInZz4Bq2cGqm/eOpt5AqPALCSpWUhSCxiZ VjGKpJYW56bnFhvpFSfmFpfmpesl5+duYgTG7LZjP7fsYFz56qPeIUYmDsZDjBIczEoivHdc nicJ8aYkVlalFuXHF5XmpBYfYjQFunsis5Rocj4waeSVxBuaGZgamphZGphamhkrifN6FnQk CgmkJ5akZqemFqQWwfQxcXBKNTBZ6veHz7ZQivwh/ePr8sgFG3t2urb8Wnv7C19oqKuwfIrM q6+zz07fonMspcXWSOyVwiOTnI4n83hcNomu2+mycCqrcf5UMxdWx5Cnq5Vuvsuo3/JDZ1f7 JEup4Cr2X+Yn303a75/mv6H10RrTfVZRH6ebSM4VNtyvo857a7FLT+odGeEu3tk89SE/PixU O3LiVMt/wZeFL6axXNu4iTf+ztfHPOVSe47cbpJdZJlTlsibMvOrTsKJ6c+uWcp5ea7I/pvQ YbsstldPYOPF2+3LfjLIrEmZKPpxm8XeOM62fdb3fCZdkTpuuc/qXbBIdqPdihVznyc7vP35 Xe3R/J2lD9Mjd9i4eVaovF0c+ZtNiaU4I9FQi7moOBEAmzuTD2IDAAA= X-CMS-MailID: 20220803094815eucas1p2dfab477daf4f2eb05342d756fdf7f14d X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20220803094815eucas1p2dfab477daf4f2eb05342d756fdf7f14d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220803094815eucas1p2dfab477daf4f2eb05342d756fdf7f14d References: <20220803094801.177490-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 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 Introduce a new target type DM_EMULATED_ZONES for targets with a different zone number of sectors than the underlying device zone number of sectors. This target type is introduced as the existing zoned targets assume that the target and the underlying device have the same zone number of sectors. The new target: dm-po2zone will use this new target type as it emulates the zone boundary that is different from the underlying zoned device. Signed-off-by: Pankaj Raghav --- drivers/md/dm-table.c | 13 ++++++++++--- include/linux/device-mapper.h | 9 +++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 31eb1d29d136..b37991ea3ffb 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -1614,13 +1614,20 @@ static bool dm_table_supports_zoned_model(struct dm_table *t, return true; } -static int device_not_matches_zone_sectors(struct dm_target *ti, struct dm_dev *dev, +/* + * Callback function to check for device zone sector across devices. If the + * DM_TARGET_EMULATED_ZONES target feature flag is not set, then the target + * should have the same zone sector as the underlying devices. + */ +static int check_valid_device_zone_sectors(struct dm_target *ti, struct dm_dev *dev, sector_t start, sector_t len, void *data) { unsigned int *zone_sectors = data; - if (!bdev_is_zoned(dev->bdev)) + if (!bdev_is_zoned(dev->bdev) || + dm_target_supports_emulated_zones(ti->type)) return 0; + return bdev_zone_sectors(dev->bdev) != *zone_sectors; } @@ -1645,7 +1652,7 @@ static int validate_hardware_zoned_model(struct dm_table *t, if (!zone_sectors) return -EINVAL; - if (dm_table_any_dev_attr(t, device_not_matches_zone_sectors, &zone_sectors)) { + if (dm_table_any_dev_attr(t, check_valid_device_zone_sectors, &zone_sectors)) { DMERR("%s: zone sectors is not consistent across all zoned devices", dm_device_name(t->md)); return -EINVAL; diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index 04c6acf7faaa..83e20de264c9 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h @@ -294,6 +294,15 @@ struct target_type { #define dm_target_supports_mixed_zoned_model(type) (false) #endif +#ifdef CONFIG_BLK_DEV_ZONED +#define DM_TARGET_EMULATED_ZONES 0x00000400 +#define dm_target_supports_emulated_zones(type) \ + ((type)->features & DM_TARGET_EMULATED_ZONES) +#else +#define DM_TARGET_EMULATED_ZONES 0x00000000 +#define dm_target_supports_emulated_zones(type) (false) +#endif + struct dm_target { struct dm_table *table; struct target_type *type; -- 2.25.1