Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp14419lqo; Wed, 15 May 2024 18:56:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXocDeS3/jQSFzoFYiuCBh/sJbCwPp7fjS/6U25cU6dYcOlut+p1k8FfBj2syiOfBq7EjhF/O3rwrCUb9Iwt4rIpHJpSyevxQz6ScSITA== X-Google-Smtp-Source: AGHT+IFq50x01RcqZ7q2doDBA8ZaIoNjFt4c53XAQOvW/3YSmfd1pKD5xdTs2YhUf2MGzYZQfj/t X-Received: by 2002:a17:906:2746:b0:a5a:84f9:df73 with SMTP id a640c23a62f3a-a5a84f9dfd2mr426183566b.38.1715824581420; Wed, 15 May 2024 18:56:21 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17946361si799718366b.51.2024.05.15.18.56.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 18:56:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180557-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=MCrUkypC; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-180557-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180557-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D11AC1F22386 for ; Thu, 16 May 2024 01:56:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6890F15D1; Thu, 16 May 2024 01:56:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="MCrUkypC" Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2042.outbound.protection.outlook.com [40.107.117.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 799A9EBB for ; Thu, 16 May 2024 01:56:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.42 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715824572; cv=fail; b=HTJHCOyh3pubhjSyLeAl6WuHg7036QlbZR3S20rjN7txvYPYZZUVVa3KXG7eqkWfu72ZigXxxFVdi1ESIBsJPeeCQ90VHodV3wz5ppH03xZlK12LdW16m3j+OdgYNkdVj7mhjHyAp/vakUsKjLWPMBjwiE+cLzNRIfaHSIQpcyc= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715824572; c=relaxed/simple; bh=sebfIh+xnVtbOfN19elqf4/s5YK6KmUMtZmb7Xr311o=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=R74I5LEgMxW3UozjuorVc+mtovAo2Qy5aLz4ZHoTdgAh1+zH5f0JWUNwJgXHUuEdE2Tkg5Db1VQtRi2lG6AhzCBBcMdtI65f4A0gXiefd/t668l1NOaQVCXZLdJMBvRLRMAfkKyCl+iWSkTuW6RF336DN7wPtXWOWK3xeVjEKYg= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=MCrUkypC; arc=fail smtp.client-ip=40.107.117.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e5abjNveVktrjzvWhMhFBBAdU0tMwYgR1NPwB4pCsKAU28WA+Al89YBU90t2V6aHlGT9xNv1YjF4YhmVV6zIlME52YGjO2zk3EvxqIsB6Bn3sjghLGiDi2dapZxKkaebCP5Nriqtz97QYFxM2qSyt1TdzUF7TuL0SMcg/ye+1cQ8X+pDBlI/ufVxTyTIHYbVc4cbfZVs38MHGtdm4uvmagAtlv4oKezSOuX6+q2+3SWilpiC2RTgbBnxKZeL/s2somb+NJqKrmfx9qdmHiJYDIcI1M5fpELoEJVTjtUK39SQxqFZvOORdUPaEJkbfXvjqfBCDNWAZkAW0C9Jh0CQHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dx53n1MYeBh680L5d2h+x4yqPY9cWHO+C7PrageE7pU=; b=nIoRvzY4oXv2zr1sVqWT+0xBIIBEBz791h8WQwyklVocmcU5g6F3BYjIE0ZaIInMt0p8wdqa/iBDC9/9AiMm0hDComt2df5t1x8lRu0McNknJHAuW09fNCTjiit6qpAa1nJH8e9JWWU4MvU4zaiiFwY/8YNDFurHIHpLfZ/evdKE6FTx42PSFyGxLih1jRKrALKTP+dcKTute6WpTegFxbypNWjC8Z/1l7P8FFZ5OD4AsjlAPz6MdET51F9iAMQd3y1gT6kkcTQsfi5gOhsxm5icXJYD9ZMS1Y73+h4dsgXGZDM5bZh6c71DUXK+RI0/6/qJdtfDgyq9vkjyakZqWA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dx53n1MYeBh680L5d2h+x4yqPY9cWHO+C7PrageE7pU=; b=MCrUkypCppNOh/lX6naXaQTu8lb0vgRFy6s002TySdTjKJp42hUo06QXbs7B3jYyiEZalAeXAI8uRU8GCHVtxx4JWQ+jNR58IjVtIN1L1gN1UKb/w+kNOVOzk+3Ks23hQ+68S5CeSBsaKn5fl9XwoJ9cdKyDR0CRbkS2WF9ySdkZJ21ygoF3HW5WNKsmgdMZYjKVa6/yKo+2W+hDasfWC1nFVhPiW0dY7yTJ548vVJVAmTOPHBZK+PKf3fJ6VaUKFBfM/Lc/pyzwcZ5+mf0x3CuazjlgDkPbkxzGQTAORirOv2bWZfSVFYJ39Rm8IbJ9QpgEhliyxzGxDCk3E3H2Rw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYSPR06MB6411.apcprd06.prod.outlook.com (2603:1096:400:42a::11) by KL1PR06MB6041.apcprd06.prod.outlook.com (2603:1096:820:cb::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Thu, 16 May 2024 01:55:56 +0000 Received: from TYSPR06MB6411.apcprd06.prod.outlook.com ([fe80::8e76:5af3:e027:ccee]) by TYSPR06MB6411.apcprd06.prod.outlook.com ([fe80::8e76:5af3:e027:ccee%3]) with mapi id 15.20.7587.025; Thu, 16 May 2024 01:55:56 +0000 Message-ID: <80ddcd90-2e1c-4fbf-a45a-b1b5ff4d60fb@vivo.com> Date: Thu, 16 May 2024 09:55:53 +0800 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/5] dm: support retrieving struct dm_target from struct dm_dev To: Benjamin Marzinski Cc: Alasdair Kergon , Mike Snitzer , Mikulas Patocka , dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org References: <20240514090445.2847-1-yang.yang@vivo.com> <20240514090445.2847-4-yang.yang@vivo.com> Content-Language: en-US From: YangYang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: TYAPR01CA0186.jpnprd01.prod.outlook.com (2603:1096:404:ba::30) To TYSPR06MB6411.apcprd06.prod.outlook.com (2603:1096:400:42a::11) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6411:EE_|KL1PR06MB6041:EE_ X-MS-Office365-Filtering-Correlation-Id: e28b7b7f-f175-4072-2b99-08dc754b5380 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|366007|1800799015; X-Microsoft-Antispam-Message-Info: =?utf-8?B?WlNabDJsTExYM2dBN1NZYzlZUitaS1p4S0s2U1dzRFcyL3d1WUc2NUxNQzJJ?= =?utf-8?B?R0srQVNTc1VLby93alZ5eHhWekJCdWJEd2UxTGJvWXdTa2FjVG50T0ZWQ1Vi?= =?utf-8?B?T1JZdWZLb0pXUEFVUGQ2Q2NVM2FIQTA0aGdkN2l6TDJGMW1FQURycjFZU2NM?= =?utf-8?B?Q2FFZmJlSUhYZ1Z2dVpqUTFSM21XaG9DNC9NNmlmczFQY2Y3SHFoaUZZQVVQ?= =?utf-8?B?YXpxcUFNMTQ3cHF4S3dhTGhuS0x0SW5QL3JiZXdGeG9xdmxibm1FTTJnOGV2?= =?utf-8?B?dGhSMy9oTXdVZ2d1VjhNcDgwdXo0YmhhdHhXQ2gzMzc5ZmpRTGhGRG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uZUtIeGprNGhaeEZYR25N?= =?utf-8?B?YmYwd0FXNzBIb2EwL0JLNWQ5SVhFc3JVNWVvcDhaekRwRXZNN2N1MDFoUmtR?= =?utf-8?B?OURrenZ0Lzg1OU54M3RITERzbVNzT0ZQZEZiVHhEZnYreFZ1UzJ0emNuTnQw?= =?utf-8?B?SkVXZHZ6UFJ3TkxXT1NPazM1SlgvWll1a25ZRFBwS3k1TW5ERFJVL1F4Q004?= =?utf-8?B?QitjUlNWbzJEVFFWc05Ha0liY0dMVjJ2WkpzNDBjRVdvcDJxSEJxc0FPVmF1?= =?utf-8?B?ektnd2lkdFgxaXRCZkdabVRnbmJqb3A3TnVNV2VrOTE3MmdqMXhnNmZjeWVL?= =?utf-8?B?ekFEdityQStnemdxNjZwTWlXTFMxeEpNcjVmMkVieXNHNmFxc1dVRzc0elg5?= =?utf-8?B?Skd3eCtCVHJCbmREc2U3L1ZMQU5GU1BSS0grcXlpY0hVUDlpVXhhbHZLZHlq?= =?utf-8?B?SmozYkdxZ3pSZTFVR2RObVRaUm9DTTRYZEZIbFUzaTRick5qaktkTlBBPT0=?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYSPR06MB6411.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(366007)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Yjl6bmpuUFVQSlRwVVFTSDBtRkwvTGZOVkZ3dW4rejN1L1ozeGp4TnUwR3Uy?= =?utf-8?B?M3U5eHQ1dGtsSHUxTyszOHQvQ3k2bFlLRDRocUxHWEhnU29VbDRkTEl4Mk16?= =?utf-8?B?L0JBQ09lS2picmI2V1JSQmVjZC9kWGRWRmRCTDFCdXV2V1hZMG1ueUVheUE0?= =?utf-8?B?SFlJK29LUFBLSHFPSU9uMjhJeFovMkZV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cDNnMi9UUlYrcGVhZzBNOWJmMUhkMGpMUGppcnp1K3dxK1hh?= =?utf-8?B?bEIzR0pUTDhzaDJoN1lEQS9zK3g0d25QYWNJZVVQbUZDTFBrWXEvMVVicHVK?= =?utf-8?Q?GocoQ5MfvhYb59tN3JtYLGK2e?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e28b7b7f-f175-4072-2b99-08dc754b5380 X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6411.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2024 01:55:56.4518 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3quVZE75mIfLYEnSmTqDo5UI2yFznWLVMUWsNRPBqEquv4yG/Nrlkdz1Cvg2EOtTePlL74fJrMhQ8QxPaFCSMA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6041 On 2024/5/15 23:42, Benjamin Marzinski wrote: > On Tue, May 14, 2024 at 05:04:42PM +0800, Yang Yang wrote: >> Add a list to the struct dm_dev structure to store the associated >> targets, while also allowing differentiation between different target >> types. > > I still think this is more complex than it needs to be. If devices that > support flush_pass_around can guarantee that: > > 1. They will send a flush bio to all of their table devices > 2. They are fine with another target sending the flush bio to their > table devices > > Then I don't see why we need the table devices to keep track of all the > different target types that are using them. Am I missing something here? I attempted to enhance this solution to support additional target types, such as those with num_flush_bios greater than 1. > If we don't need to worry about sending a flush bio to a target of each > type that is using a table device, then all we need to do is call > __send_empty_flush_bios() for enough targets to cover all the table > devices. This seems a lot easier to track. We just need another flag in > dm_target, something like sends_pass_around_flush. > > When a target calls dm_get_device(), if it adds a new table device to > t->devices, then it's the first target in this table to use that device. > If flush_pass_around is set for this target, then it also sets > sends_pass_around_flush. In __send_empty_flush() if the table has > flush_pass_around set, when you iterate through the devices, you only > call __send_empty_flush_bios() for the ones with sends_pass_around_flush > set. > > Or am I overlooking something? If I understand correctly, you are suggesting to iterate through all the targets, handling those with sends_pass_around_flush set, and skipping those where sends_pass_around_flush is not set. I believe this approach may result in some CPU wastage. for i in {0..1023}; do echo $((8000*$i)) 8000 linear /dev/sda2 $((16384*$i)) done | sudo dmsetup create example In this specific scenario, a single iteration of the loop is all that is needed. > > -Ben > >> >> Signed-off-by: Yang Yang >> --- >> drivers/md/dm-table.c | 36 +++++++++++++++++++++++++++++++++++ >> include/linux/device-mapper.h | 3 +++ >> 2 files changed, 39 insertions(+) >> >> diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c >> index bd68af10afed..f6554590b7af 100644 >> --- a/drivers/md/dm-table.c >> +++ b/drivers/md/dm-table.c >> @@ -741,6 +741,8 @@ int dm_table_add_target(struct dm_table *t, const char *type, >> if (ti->flush_pass_around == 0) >> t->flush_pass_around = 0; >> >> + INIT_LIST_HEAD(&ti->list); >> + >> return 0; >> >> bad: >> @@ -2134,6 +2136,25 @@ void dm_table_postsuspend_targets(struct dm_table *t) >> suspend_targets(t, POSTSUSPEND); >> } >> >> +static int dm_link_dev_to_target(struct dm_target *ti, struct dm_dev *dev, >> + sector_t start, sector_t len, void *data) >> +{ >> + struct list_head *targets = &dev->targets; >> + struct dm_target *pti; >> + >> + if (!list_empty(targets)) { >> + list_for_each_entry(pti, targets, list) { >> + if (pti->type == ti->type) >> + return 0; >> + } >> + } >> + >> + if (list_empty(&ti->list)) >> + list_add_tail(&ti->list, targets); >> + >> + return 0; >> +} >> + >> int dm_table_resume_targets(struct dm_table *t) >> { >> unsigned int i; >> @@ -2162,6 +2183,21 @@ int dm_table_resume_targets(struct dm_table *t) >> ti->type->resume(ti); >> } >> >> + if (t->flush_pass_around) { >> + struct list_head *devices = &t->devices; >> + struct dm_dev_internal *dd; >> + >> + list_for_each_entry(dd, devices, list) >> + INIT_LIST_HEAD(&dd->dm_dev->targets); >> + >> + for (i = 0; i < t->num_targets; i++) { >> + struct dm_target *ti = dm_table_get_target(t, i); >> + >> + if (ti->type->iterate_devices) >> + ti->type->iterate_devices(ti, dm_link_dev_to_target, NULL); >> + } >> + } >> + >> return 0; >> } >> >> diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h >> index 0893ff8c01b6..19e03f9b2589 100644 >> --- a/include/linux/device-mapper.h >> +++ b/include/linux/device-mapper.h >> @@ -169,6 +169,7 @@ struct dm_dev { >> struct dax_device *dax_dev; >> blk_mode_t mode; >> char name[16]; >> + struct list_head targets; >> }; >> >> /* >> @@ -298,6 +299,8 @@ struct dm_target { >> struct dm_table *table; >> struct target_type *type; >> >> + struct list_head list; >> + >> /* target limits */ >> sector_t begin; >> sector_t len; >> -- >> 2.34.1 >> >