Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp51545lqo; Wed, 15 May 2024 21:03:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUDo8UEEx77LPmM065uGA/9jZQqnVqV0RX7yLyO5kWYu2g4JWAu7vwcpxzYXKLigJJUQYxrG0i7yWmBU11WP4zYHUs6l/cl8IWS2L7OSQ== X-Google-Smtp-Source: AGHT+IG1uqoFdcveuQh0PFO4jDjcF7+xoobaeRO50v4LWLc+p/8lijFINaVFwyyNy+JiyTHC2oJ7 X-Received: by 2002:a05:6830:44f:b0:6f0:5a46:702c with SMTP id 46e09a7af769-6f0e91175e3mr21440166a34.12.1715832220087; Wed, 15 May 2024 21:03:40 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-64f27d209ccsi4418297a12.225.2024.05.15.21.03.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 21:03:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180610-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=d5cl490q; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-180610-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180610-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 8ECD8B22EEE for ; Thu, 16 May 2024 04:03:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 420B78BFA; Thu, 16 May 2024 04:03:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="d5cl490q" Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2051.outbound.protection.outlook.com [40.107.255.51]) (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 340F646A4 for ; Thu, 16 May 2024 04:03:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.51 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715832186; cv=fail; b=Fg0FvSg4bx8SF7fLvcJoPOns3zN7VzmUtg/lf3pDrPc1EvzDiw2FvdC/Vt+ruMH1iVbgAxWuvMUgCZY7dbhi86myWvOG/KlzDRZ8exdHHAeRMwSQgatqAIoLYDJ4DdZxppl7zfj7FnIyVSI4YfFt2oE2bEK0KfiUjQAQ4CIMu28= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715832186; c=relaxed/simple; bh=d+6J0DopE8a1tqTqwm3DC/qdhoRyEx3y9opRon/FBkE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=OieSAK5SMIEjpn50UxWpw2kXzFGfZw5h2NEtYskP9luyupOSZ/FQ1LKQCi4xOWWvUDnEXBApqVsWPt0P8bKS/HDzGP8yxuxyPdw+0Gny28yPABuW/6Q1ycBNLMQg7MQZv+hhJ4AY8rlsrT2wXmmjGFP10ZNIAKiFuViH9MBUbF4= 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=d5cl490q; arc=fail smtp.client-ip=40.107.255.51 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=h7iCakEba/dqyv1d2TroV6PZmiuINWVf+D8N4KRv9EGX5somammvZI6fkWRmdXuVk2qlswOUBHUw4BmfYZ7gIJ7jCB4N5Ub9qGGV4fY9uoYWFOAkCdIY6jajZ53TbcnHYUwZaNEfg5BKiTb1GM7/RVcwzEeHmjrC1/0PvvRwHra+ygwLj62pPd533ZP6uFUjQIRcnS44fSH777Zi8BZqK26uL2KsOSV7L8Gc+Le/IUnIcAvyvboiaeOS62z2wIB57+uGobnq1L2o728zP5ZQ4JxqZjpFtqWMqDphWaXQgKMQFhyqMYqB5CeAmqikzmqLXAuaMvgKBOydPh/mZxmC+w== 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=4Ly6WgXtiz0dA/xzmP8OTqpgBcoRWGdPsXGNgS1wPGE=; b=ako8OfN0/6idztOMu4ggTWxP4AJjjSSOEHWZAb0gelJB0/5A7gHZ0Iie+6fbrHG1jDLY4HOaiQ5fa1d2uA3KEmWyE9iVYG9ggT7UqQ+KN2zCVrS4AN9oBhs7Fr37xM7gRo6ZYwOGuYcacFxD7qyUBmlg3QBgiKx+AkyIhrrW35od1e/yUenHnn7t3GMWxoucr6ISemGXX/ZcpRZod4iaKxmuuJyNh5L6/hhnUhnkqg5v4RBEWqy4Biz9PoNxHG0tks28PRmbbGrubhjy5iyTFnqOuRANiRKWnS8ihdQ0R/T6GnGpEUovLnvA8zuUxs0OYSqWwn4AGnMf5ljDhcKCMQ== 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=4Ly6WgXtiz0dA/xzmP8OTqpgBcoRWGdPsXGNgS1wPGE=; b=d5cl490qJBFVZ7r8unUi7NlDnshmamU41SOqEgAN19sk5A17BmiBeXx8LpX/+6vwUpKSmgUelDH69yKTYpH2kwC3TBVLZI472neuKtyCn9oMv850GuoxoUs7EgI06gIkhl0JYlSrQDpGdkAh61ybfzuiGQNuGfyMX3/5Tl2v+6QtViiZ6bE+08oE+ANO2YX3nB5cT+1hHrPYSbcNrrrhDHNJD23peopr8HPH0R44NKeYTU3hkareArI7qmMOvgVD0gRs6Ocpv+3HIt2rA7IRR19pVbZLaqdk+NryZjBx9gbBxYYdDRauNUq07+NV4wcB2HYzyhFYevqvmtVi99k6Pw== 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 TYZPR06MB6807.apcprd06.prod.outlook.com (2603:1096:405:1c::14) 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 04:03:01 +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 04:03:00 +0000 From: Yang Yang To: Alasdair Kergon , Mike Snitzer , Mikulas Patocka , dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Yang Yang Subject: [PATCH v3 1/5] dm: introduce flush_pass_around flag Date: Thu, 16 May 2024 12:02:30 +0800 Message-Id: <20240516040235.115651-2-yang.yang@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240516040235.115651-1-yang.yang@vivo.com> References: <20240516040235.115651-1-yang.yang@vivo.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: TYWPR01CA0017.jpnprd01.prod.outlook.com (2603:1096:400:a9::22) 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_|TYZPR06MB6807:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c44fe5d-207e-4491-786d-08dc755d136f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|52116005|366007|376005|38350700005; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?FdwwhYe5Syn2s7EH4wBJ/4MOnC7eSQy/RqeCTvunN0eA1iOOAV5+2fTRs3yw?= =?us-ascii?Q?c8UYN1ElAOL2qdUHyIWxcaXqtuaggEHbofGaByDda1oAOv5CjCjDv/SeV/uL?= =?us-ascii?Q?gwFl2GvFQbQWVsOIvTC7VhBJrJiWAJgrFJjeWCA945a/LGz6PImHWjQft1Zu?= =?us-ascii?Q?zDN7F5jq0nHBPSTKmcS6SM6F/Ia2eUi7GHeh9I+dgJyCV/D1U7AK8VVkJbxH?= =?us-ascii?Q?j7ntLpb/CesRAjAuia0Ts7fZh4vlDDWHhFcKc5YRgDGn2EjXTggbm4xsOdgt?= =?us-ascii?Q?xHM7368+D28USPitCwcy6DKqXmzKuGobanj82RbEvSOu4UKtdnXKcoHbjaGf?= =?us-ascii?Q?ecGFuujlGK5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YKA/?= =?us-ascii?Q?Noxe/Eigqf5JGzzvix+3kN/HEA57L8upS1676GwxJEmrXbTYHTWJqFL4RsAF?= =?us-ascii?Q?AxJMSbg2Vpl6kSpImp59g+BI5RccKuPaUKhGucPWQiZTVw=3D=3D?= 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)(1800799015)(52116005)(366007)(376005)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?1OSWjcwLgYsSEAZUEvgKHzUvrI2jwMUTXcGFY6GseA8F/sEN3xBoIXR0Bobt?= =?us-ascii?Q?IBVC+YGSfiGmuusF7lvxNYu/bFZ70GdkLcGQPYNsBwhYcMWX/gIH5+jWpVY3?= =?us-ascii?Q?tKWFcE8eay8zM1dGudrPecGnxPUtN+65Wnu4c3qvBeWZdvasq7E7CtDMAkdt?= =?us-ascii?Q?1+lTu1G2p6SUi0LPN2diaVryHqNgtBimnjzOxUGdDwuwBKCipg75mFCal2ms?= =?us-ascii?Q?QlyIReWrTRjjR5EdErXngJMxMlJZGYI2rw9tgJMGd5mw10OtV2iSQ/qElMTw?= =?us-ascii?Q?01nyqP+gDTqDf1K4ZIFfww3D6/igZQeYwFXWaAqoNL4g0PU+SZKFPkHNkJ5/?= =?us-ascii?Q?3GO1BBUp7pltT3+sveb2siZRMVXMnEYL1dY0JQwLhCm2UAvbusrn/tGhV9cH?= =?us-ascii?Q?Zmv54DinOw3PBpGvlJcABw3Kk1iukw8BhNN51SQre0C3RPfbH07bNb/Fw7u4?= =?us-ascii?Q?FoKRzN0QMsa9lOSSmHsHIF7Z3P3XE1bygC5pmADkZjq/hfULvZRJq688dJa7?= =?us-ascii?Q?EMiivf6qyMyFejHn4Q6RGj4L7NbNxpTWGuGp0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us-ascii?Q?wNiRj4xnenuEGW3AHCuJAayD8pUOePMjUr2Z9ITLsXRAwlmuBA+UVg0XWmhA?= =?us-ascii?Q?oiIQ5BV7CbokKQp2zc2hCwIQfGIf5Dgu7/RvBWl2EnOGYCrRzVadEeQYuDfD?= =?us-ascii?Q?A2WcqbnJSDxsB7RyC2Whms99y2aJE/akcl2tl/qU?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c44fe5d-207e-4491-786d-08dc755d136f X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6411.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2024 04:02:59.9830 (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: qLlIFVmCPhGUs/p1DBNJlv9rb2BaT2i0c7ZSD1iQ4tskE2lpSwD0j8UeCpho7uax0aUVKHQIjp0+RA8MzNEmyA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6807 introduce a per-target bit "flush_pass_around" and means that the target supports flush optimization. set a per-table "flush_pass_around" bit if all the targets in the table have "flush_pass_around" set. Signed-off-by: Yang Yang --- drivers/md/dm-core.h | 3 +++ drivers/md/dm-ioctl.c | 4 ++++ drivers/md/dm-table.c | 3 +++ include/linux/device-mapper.h | 5 +++++ 4 files changed, 15 insertions(+) diff --git a/drivers/md/dm-core.h b/drivers/md/dm-core.h index e6757a30dcca..b273f25b634d 100644 --- a/drivers/md/dm-core.h +++ b/drivers/md/dm-core.h @@ -208,6 +208,9 @@ struct dm_table { bool singleton:1; unsigned integrity_added:1; + /* set if all the targets in the table have "flush_pass_around" set */ + bool flush_pass_around:1; + /* * Indicates the rw permissions for the new logical device. This * should be a combination of BLK_OPEN_READ and BLK_OPEN_WRITE. diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index c2c07bfa6471..bb178df2a340 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c @@ -1445,6 +1445,8 @@ static int populate_table(struct dm_table *table, return -EINVAL; } + table->flush_pass_around = 1; + for (i = 0; i < param->target_count; i++) { const char *nul_terminator; @@ -2279,6 +2281,8 @@ int __init dm_early_create(struct dm_ioctl *dmi, if (r) goto err_hash_remove; + t->flush_pass_around = 1; + /* add targets */ for (i = 0; i < dmi->target_count; i++) { r = dm_table_add_target(t, spec_array[i]->target_type, diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 41f1d731ae5a..bd68af10afed 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -738,6 +738,9 @@ int dm_table_add_target(struct dm_table *t, const char *type, if (ti->limit_swap_bios && !static_key_enabled(&swap_bios_enabled.key)) static_branch_enable(&swap_bios_enabled); + if (ti->flush_pass_around == 0) + t->flush_pass_around = 0; + return 0; bad: diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index 82b2195efaca..0893ff8c01b6 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h @@ -397,6 +397,11 @@ struct dm_target { * bio_set_dev(). NOTE: ideally a target should _not_ need this. */ bool needs_bio_set_dev:1; + + /* + * Set if the target supports flush optimization + */ + bool flush_pass_around:1; }; void *dm_per_bio_data(struct bio *bio, size_t data_size); -- 2.34.1