Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp778693lqo; Fri, 17 May 2024 00:52:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUBAf6hfh+bjct2K5iqBEIH3DAx1ka0p5R+Ny8qt9dcPskjqHWoeFNSSvjeqb4hNoz5ZDhsKZLrEgtJaVQ4h9OyZVdmHY3HjLYdkoPyIw== X-Google-Smtp-Source: AGHT+IFqZAlIeYXkpx7o4dhedWsMlQereMNK3UkiprPK5o8RizpdpZTHNng5HTfmJerTZvloHzD+ X-Received: by 2002:a05:6a21:2d84:b0:1af:f89d:831c with SMTP id adf61e73a8af0-1aff89d8494mr17549197637.37.1715932335093; Fri, 17 May 2024 00:52:15 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-64bfb73e21fsi7244112a12.135.2024.05.17.00.52.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 00:52:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-181816-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=DlqZ7Mhd; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-181816-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181816-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 6A777B21B96 for ; Fri, 17 May 2024 07:50:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 815261BF2F; Fri, 17 May 2024 07:49:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="DlqZ7Mhd" Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2080.outbound.protection.outlook.com [40.107.255.80]) (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 88803175BF for ; Fri, 17 May 2024 07:48:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.80 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715932139; cv=fail; b=PdBzN7/XNOG3YJC4ItbizfOZKXF+0/we1dlgJg0Y2E7dpPoip73dTJolDiE1q1XSa5IBMD6uT6yMcwu9VQJETbWMttSxE6bFCUQi18BBd8FoSeoHPoekqdU1Nv+XygqfP4LIQIlFbk9ayonOJ1m/Ld+MyMYM7XxV4QmYEXCpcEo= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715932139; c=relaxed/simple; bh=bwLYGk7p5mxL4A02drJvPEyR367cKRry0+OzF2r7Kpo=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=Sc1D0KRWyLnq8ZpoX7D24mziecgSDFF7rShvpxyhYRRmgQhb8qRs6HCCsxwMemp2QRjuznI1B1iMzCnP4sb3MncS/wDOFwMXCcVGUSq0t2Ed+UygjrCN2XxXFDDbbn1tz65v+hudEhJW+Bs9D305epjAkiB2sh8e0A3PCscqGZQ= 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=DlqZ7Mhd; arc=fail smtp.client-ip=40.107.255.80 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=DFLc/5KoeuFxluZMoSveAjOEq5tqGCjNc8p/s+UazBLTG4t5mu2HUuoiYfxhPScuHkU1hZMSzzH+nLKajHkMJWOvrmvGO97p03SCFXRsgEhHNaN4FxVP10GgV5vA2JqyTz0S7gHN63ExNrjcrKD6tqKhPJE5qigh6Ao97I84tUnx90NqMFlLMTI6bYFF2G7cDa+jyYrgpeZ9DXsOs7Y2iDMppVr7OQG/q2afJQCSE+sypp5la5IQDpFrQSVCAYsAioMqrf+RAyPqvDIkdXQX8cmBgCRRiyeaL/8vAGE4/SaV84uuNG8aGnK3BQeYJjo4IZQhThKizZ+rTb+5vLVzpA== 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=6WHPDxfQC8Cz0SKLPSS1k0tQuqB2OfZM9qyLrgjZk8k=; b=U8OLdQr9ekogJKEDPspT+P4l4TUqsPkr6H0bWv3JsdTVZ7wLN060vPlJi+sldXenJYtYrMIdHSNiBF0uJsKzDRJSsz4MQEMsJop2yvVbjvaXuU3aHQJYvzoJ8WfCJcRGvef3Vcto1U9v+jq4ZXLWOHCfB0sVZoXJgFPB3X2eJE1xmJS36yzxcRgAJPI0E2V68hFGzNWFIcUHUy/gmrhUHgnpMb7ytVwAqApndiO/yVXNed8ke/3cvcg0mc4a7YqNBnrOGMlXZsbHCGsCpLxlInxu6qBCcXzh7lHiipzbX6t1wNY/NDgpDplNOeZwEBPxBvjRMtwdQ7ZQnX086M9YPQ== 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=6WHPDxfQC8Cz0SKLPSS1k0tQuqB2OfZM9qyLrgjZk8k=; b=DlqZ7MhdggRhbV8gAoDT8w4CxixCTzJmDnVXoT0XS/KqLV6GGlCtyk+/4kV0rIjubl2GQLjmS+vKHzTSMzmY/claBbMRzhOixQwKvCejejnN/6sdCiJT0VJKzEqDZXvCHzy6b/uU0Di4gMYvtuckv7xEGYdP8++1FJdkQBEGDcquSWNNC+29KZPot/wo1I2IyQhfnS3fX+6Urd50MUkFXH/9NAIK0HTEbK6GeqAKW7Z1KUFuG0teVt2ZUx2z7b2Q4zJ5JdK38JpQz31g4Fg+UQWwlf9AgDbDvnMIfRMUpI5gsiFrwx3qi0k7L9wt6tyGkE9vT/M1bdEW+nKG/t0usg== 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 SEYPR06MB5669.apcprd06.prod.outlook.com (2603:1096:101:bf::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.28; Fri, 17 May 2024 07:48:53 +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.028; Fri, 17 May 2024 07:48:53 +0000 Message-ID: <8f49b95e-88df-48b8-9311-8a15414d8107@vivo.com> Date: Fri, 17 May 2024 15:48:49 +0800 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/5] dm: support retrieving struct dm_target from struct dm_dev Content-Language: en-US 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> <80ddcd90-2e1c-4fbf-a45a-b1b5ff4d60fb@vivo.com> From: YangYang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: TYCP286CA0023.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:263::10) 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_|SEYPR06MB5669:EE_ X-MS-Office365-Filtering-Correlation-Id: b13edea2-8710-4910-bdb3-08dc7645cc7a 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?U3dnODdjRGo4Z3VsbW9mcWMvTjdMSEg1ZHlRalEyd3pEaTl3UktYR3pDMVEx?= =?utf-8?B?ZzRJbm5DSkVsN2FDME8rQWYvdXYzbnl0aDdJWFhacWNNK2xUdThwUTdaWmNE?= =?utf-8?B?R1VJWlBseVY5TWFibUdBVkdrbHZGZGNybDRFOW5yZVN6M0pjQlFEWFNZc0k4?= =?utf-8?B?SURMN21SdmlJenRsNE5CcGJMKzN1QnFFbGMxZjR0OVZzUkhva0NFMldpUGJT?= =?utf-8?B?Z0tlRmRneXo3RFoxbWEzZi9rWnZPMDU2UmZTandWQ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c3htUS8xZ1RralRoMjg1MXNUblNJUzExUDVkR1hLTXlZ?= =?utf-8?B?QlJUS21GQmE5Qkx5ZnFEVGdMU1lnNUpvWkFJeDd1Nms2a0g3OVlRZ2lNNHRW?= =?utf-8?B?bHcraHh3ZUN2V0xEYkFxYTNpUjE0RUFjQ0R4QmFTUWhDdktwTDlTZVY3NEt4?= =?utf-8?B?Y01FL211VWZEMzJJT2FoSmdOYkhFelQxdk9YS1JmYjMyZ2lKa3NPRGFJYWl1?= =?utf-8?B?ZDNod2dpV2pUL3Z0bTgwRjF6ZjJQQ3k0d1F2ZThZK01SWkVwb08xb0N6OUJE?= =?utf-8?B?ekpKdWt3KzlXa3R4WGh2RTFncndIUHBQN2UzN01uMllCRTJPVDkya1lVVFFu?= =?utf-8?B?VFR3dmg2QTJ6T2ZLSnV6NUo2VkpvSm12UGJySFEwVnhoU0VMZDJya1NNRkhI?= =?utf-8?B?dU1kU3hHR0xxYkwwaHBLNjA2RlVXSGFZY0tPUkFaOHQ3V3V5QVZUdkpFRWwz?= =?utf-8?B?YTE1VDl1bXpPVkk2dS80K2pkWkErK2E0UzhnWGFYQ0pGWE51Z01nVHUyZlJF?= =?utf-8?B?OXdnK2hRbGZzdnhCeDhEOCtxTmpRVFRKV3lBaFBpN09ZejZYcjFWQVJRPT0=?= 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?YWVUNEg4SEV2a0s2WmFYSjRwZlhEaCtZczRDOTdjNGVjYllNSFVPOUxMMmdH?= =?utf-8?B?RDNCZ1c5bmhMb01lMzFIeVk5ckwxVlhSS2c4cG52QzJHNk5HUmMxY3p2M3Ji?= =?utf-8?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yQ2NvVm1RTFVnYjdm?= =?utf-8?B?aVdLUFptQWJBcW9PeUdwVG9XY3FENFFxZlNVaTZyTkVlQWZGTlFaZ25xc2wv?= =?utf-8?B?V0Q3Y2YxNTRMMFdzVUxmN2pvYWRCMjNIcG1nQXAybWx6cDlkSnE3Zm1qYzlx?= =?utf-8?B?dHB2ekxGdGU4MFJDZE5MS2VEcE5CNHJCTHZaWnFpeEZIRkRqV2F4M0lsd2tE?= =?utf-8?Q?0Y0s8OMVYMnP8+UPQW4A+y8bY?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b13edea2-8710-4910-bdb3-08dc7645cc7a X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6411.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2024 07:48:53.6075 (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: KAYXvvAD4gNncV3SzY23ijtceVMqO18VV3GeLhGAoBjXlW+8jHRRksRz8gkqQY/pJT0jeiiv1ny/hrteuLBJZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB5669 On 2024/5/16 23:29, Benjamin Marzinski wrote: > On Thu, May 16, 2024 at 09:55:53AM +0800, YangYang wrote: >> 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. > > I'm still missing why sending a flush to each target type is necessary > to handle num_flush_bios > 1. As long as the targets meet the > requirements I listed before, AFAICS it should still work with only one > of the targets mapped to each device. > > Say the table devices are sda, sdb, sdc, and sdd. If you have 4 linear > targets, each mapped to a different table device, and one stripe target > mapped to all of them. It doesn't really matter if you don't call > __send_empty_flush_bios() for the stripe target, does it? all if its > stripe devs will still get flushes. Similarly, it's fine if one of the > linear targets doesn't get called (in fact it's fine if all the linear > targets don't get called, since the stripe target will send flushes to > all the devices). If there were only 3 linear targets, then the stripe > target would get linked to a table device, so it would get a flush sent > to it. Can you explain a situation where you need the to send a flush to > multiple targets per table device for this to work, if you assume the 2 > guarantees I mentioned above (the target sends flushes to all their > devices, and they don't do something special so they need to be the one > to send the flushes). Yes, if the targets meet the requirements you listed previously, there is no need to send a flush to each target type. I think I may be overthinking this. I tried to handle some targets with num_flush_bios > 1 that don't meet the requirements. >> >>> 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. > > It's just one iteration of the loop either way. You either loop through > the targets or the devices. It's true that if you have lots of targets > all mapped to the same device, you would waste time looping through all > the targets instead of looping through the devices. But if you only had > one striped target mapped to lots of devices, you would waste time > looping through all of the devices instead of looping through the > targets. Yes, I get your point. This patchset may make things even worse for the striped target. I am just curious, in what scenario is the "dm-strip" target mapped to a large number of underlying devices from the same block device. > -Ben > >>> >>> -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 >>>> >>> >