Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp128813lqo; Thu, 16 May 2024 01:04:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUZvgAmXPBoqKZAlCzaIgNhkbmYhTsARc04ya+w444RHG3a2l7eONmNRcWT98duE/ScRnZvuTIOpfm2ztDc7JP/ZG2zgWHlr5C5vft9KA== X-Google-Smtp-Source: AGHT+IHUx1oi0imaYudGATcoJhaEZ3rj/etUMO5Rf6u3hsNsdELwt7s9Zfz/BsmtwsU7ap1iStIX X-Received: by 2002:a17:903:228d:b0:1e5:a3b2:3dad with SMTP id d9443c01a7336-1ef43f51f2cmr235896685ad.42.1715846664795; Thu, 16 May 2024 01:04:24 -0700 (PDT) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0b9cfbbdsi157099175ad.24.2024.05.16.01.04.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 01:04:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180730-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=qdwBnQeQ; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-180730-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180730-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 667AB282037 for ; Thu, 16 May 2024 08:04:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C90BA80C15; Thu, 16 May 2024 08:04:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="qdwBnQeQ" Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2076.outbound.protection.outlook.com [40.107.117.76]) (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 141B76AFAE for ; Thu, 16 May 2024 08:04:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.76 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715846649; cv=fail; b=cUsWIRkFlyZMKLrhhu//71cEU9qhjlSTSJMzFiZb96EFxCWQTb5JalK7mQsZNJIY/Dv5foGTBuGUSexQ0XXx3fsbC51yGMfan+P3PV6lvX71Wb0kNURpl3ivf6AiUpgVJyXF9WCGf+ZGLPOye0aYlW6ft/7ZjxJJh4PxZ2FaUzM= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715846649; 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=OOovZ2ivJIy6W1IZ0MtmxKgZZ32t3FSQyQtaVlrp9vdLuElgr2qIZPzgYP8497L3GSKQRFYUVssMqJ3xhJWjYFS/itYLG+lB7EvGxhmHAkpZaTSuktY0RTRkw6H43vUW8lsucks2fAOdGw5YhbIf9TUdSFZ49sDGc0kRdtNzf7A= 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=qdwBnQeQ; arc=fail smtp.client-ip=40.107.117.76 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=ZvdIORSGMKm/2JGQxGc9dE8JmsN2WOIRj3RO6HEbHVgFPoTJfjOIPgJjsXAf9V2gfSchF4q7fjLS6oLK8vbkJGuA7YuPV7i86KNeflLKiqKyl1k5x7ifrVYVBt+oM4NDig903Y2fkhtO0DQWmU2G/eIroWCmNIF06Y2UbugIXv8tViapwnQjtRqmTsz3ALUalyIC4sS8YWKS417EmzlETbtUyDPd4wAAqN0jotuBBk3FCUe4bheCCDgej/bn/yT5+erSSpjg8nFyp9EMh0eJBQFEHQ93y6839nWV2yhMw0dZCZ5HiO72INTSqlNX5xOp/8Yirek4HwtYdjgEzuGFcw== 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=X1EwJxnQs1bdXaYD1akNySvRwkh10JIe0gTkF83g2PMoTt8+EtnytWaqjTd8XZOuHnMfpj1ATrNBfHEJQFGiyRnB6hKhUVWNuhxOiqlac1qDpS983zHMZUvqOR2Se9pqfDwAx1KYvs+G/0bbtdlPQvMNfoDvTKeX5dHWKNVZxcflygkhQxDYW9fjCoWmDntTJ13gqet8v2WAn4B03Z9ZTPZ7EMdJBv94fbQISZWz7baU+Y4yExLakfwLoFN0oXzUgWbqbw83Ho7DhFvP68sq7VGtL6YLPzgQ0mBT9V64iOAnwIm/fFe9fszo50QEJxU7NkgqbtF690KkxHdylowNlg== 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=qdwBnQeQc23rfLvLJm88kdBZAUuuGf3w0vYB9S8B324zs+XjYfdcqLJYk88AH9EfvkwMXXwNkXm/vTNk5EJvUs+KsEFLLmfJqHhMTfCBtmEvVsrCQCtNFUnK+iZQYqidXdDz2k7yCYjiVk5F/2XuBt/y8kFJOevRQFnM9TY32FvM6wmo/cO21dX6Ah4jjNJvINkciPaCv8SLO2VbwewWt4l4ZayEjEJV+iapkJZ7h1JjpKIJBuWahUudfam43NSkfYK2EeU35Yk5rvyn84y4Kx0hW9FuzdeUDswbfUHu8e2JjMonSnqqvC+I90+XjdBFFxtK6/KSPf30HcRnJSiZmQ== 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 SEYPR06MB6830.apcprd06.prod.outlook.com (2603:1096:101:1b3::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.28; Thu, 16 May 2024 08:04:06 +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 08:04:05 +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 v4 1/5] dm: introduce flush_pass_around flag Date: Thu, 16 May 2024 16:03:14 +0800 Message-Id: <20240516080318.120231-2-yang.yang@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240516080318.120231-1-yang.yang@vivo.com> References: <20240516080318.120231-1-yang.yang@vivo.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: TYCPR01CA0201.jpnprd01.prod.outlook.com (2603:1096:405:7a::18) 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_|SEYPR06MB6830:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ff2380c-6319-4787-ebc2-08dc757ec1cf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|52116005|1800799015|366007|38350700005; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Lk3WypqYDWHAEAXbTlLP9ukn8FZ/jMTX8aV30psr29JniM4MSuwkENsylIbZ?= =?us-ascii?Q?7kKCWykutwplk6VzubHk+ioyUfNzaOYKkfPvIEkqrdZ+YN/fXdUEOy2jbUgy?= =?us-ascii?Q?BxFaVioFgyESaSyYORhNUV6gxXs6UL1xvBJbJuF9JM4Mdo8Kd7xlYX3AoiEq?= =?us-ascii?Q?1vEf2rM/PScoxtp5T5jonVQldAARhTEVqpwA3o2+Iy7yMqvi1lUhRaTIqp58?= =?us-ascii?Q?h/VUgbc93ACUvUox74NiBTO3+EZnVHzu24So/RX+zbsbKIWUYS3EXyii+Iky?= =?us-ascii?Q?oR4GJtF5H5u8BybBJawx4Bj8ITa2hiw+zviIu2Po8t6SvotXbMPb5yz4XN0t?= =?us-ascii?Q?amE6u6JNbPlLd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YocSDlLyxmwadkMU?= =?us-ascii?Q?17WeWooFIyhhExnpwyW4pBr9anWKJOW7qevlCF/7W/QNd4xjd2YBKKlbbE5F?= =?us-ascii?Q?hLPLs1QGP9ifGBrxKqsR1inxq18ZvjLf5y6ZVZ0+V182Ww=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)(376005)(52116005)(1800799015)(366007)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?NKYRJyYBCHVSJvAM85MDrdRKGSn8BV1JMeJQzRUKuLrs2s21+ixD7naNenkM?= =?us-ascii?Q?eqgQjeAFyDjeWCDHQCbM+dN85y68jaL5mftJyrGqvcZbwSNl6tfhWZJDO9CA?= =?us-ascii?Q?yrpszIY38NPEGAEfPdHNGJly5DvYY35C0d0nMCRYg3dIl8niYWXX4EMJ0nLE?= =?us-ascii?Q?8LrPN3cmoPes0U3kzqh58ULQtjvlHkYn0RMzJK25mMWyZ7PiFnVyGRIYutYe?= =?us-ascii?Q?zFEIyJEg5W7B0Uf//+KbL9YvbOBWmHTzXjyIAbPBFEaudAA8fzQ+lAWN/Ly8?= =?us-ascii?Q?zZR2FFQSrpWaHz7AYMsCNpM37iumERL9GuZhtJKtE6pSM1SgrTo/i0pDpq0M?= =?us-ascii?Q?yFCXSyCUcVtZ+eUZpjW1FnbNUn0Jh86kQjXPluS2OorkDAX2XBiHm5+0OSLk?= =?us-ascii?Q?lO6ClYnR4iNMegb8Ll2n0tdCTq2irrvb0mPCNxs1F2qi2ZG3Q1uJwqxmN/Ge?= =?us-ascii?Q?MtG9gCWN1HzfIb+M7KwAvCAS2oaZV34o7Aj+r9IxbMDtJo5vs7OxtjEHa/Wp?= =?us-ascii?Q?FUnkH7By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pS1dbd8fTdxEkrJCFIlLir?= =?us-ascii?Q?MMzEKUaxrBcU4wkLF3p9oo1wFlvXwLyvBRo99WW1+o64B1iw8QFE8uWOBQHX?= =?us-ascii?Q?upPKAMPybx5Gmo0xZigTis8h3Pr7ySl7KGi6u+x+W8jhYS4JeQHGtwyT0Iqy?= =?us-ascii?Q?9NrHrAwkItbjB1hxzihwuJ+CkAGGFK+8X0s3fSR7?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ff2380c-6319-4787-ebc2-08dc757ec1cf X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6411.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2024 08:04:05.9398 (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: yayOpf+LkBvum35PH2m9v3mMdfqSGrbCj/549s66K7vix4QKt4faClkT1zrj8V+J4bPG8l2C1UZf+OkGcZp3RQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6830 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