Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp51554lqo; Wed, 15 May 2024 21:03:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVP86gKaAaNr208mj3Wz5qhWm/UZ5i3T7IDB/tQ19ctjyqzZchhfCqA7uuElcXkM6l7YLf5rZvhyP0QZsYGhxsCuBRIKQC8KV8YC6UMVQ== X-Google-Smtp-Source: AGHT+IEhe3AkYF3CejTBq2pC/0UAHAjSoLiF60h2sVnQ7mn2ouo8xPrjRYmefxAQk+cQvio76oWv X-Received: by 2002:a25:4e85:0:b0:de8:a770:4812 with SMTP id 3f1490d57ef6-dee4f3149dfmr14866923276.40.1715832221608; Wed, 15 May 2024 21:03:41 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f3078fcsi155531916d6.606.2024.05.15.21.03.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 21:03:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180611-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=hR8dt4rq; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-180611-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180611-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 49B0E1C226DC for ; Thu, 16 May 2024 04:03:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9F8A125CD; Thu, 16 May 2024 04:03:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="hR8dt4rq" 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 43FE279C0 for ; Thu, 16 May 2024 04:03:06 +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=1715832187; cv=fail; b=NZppdFj4xfJ/PJ14UN/mpayfFAQxe5Ct/OTZmKFGsisP6RvQOVMkpSe8hO5emyGqZhgxCG3+jaVIfvu20AR5A3HzVVoP3IL1ht8dhX9vTJ3RthlHPw15iXquS4T2Ii27SENiMR2YXZj7GYWdSos1pUJq2abTRwoayDlKLBmvd4w= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715832187; c=relaxed/simple; bh=Dd2Ne+wYYQlf67SHMr3G51DSNztSqYbRu48pXFAFIJc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=IHPzvzH1/vrlllkPlSP+b6OjE14UJdrVaAxJMxqwtCsuzMn1HciZdwY17Ykv6wHjqJuJZK8ke++NLBbPBoD03s5jxjjW2ygFOKgrV/z/yjzYJFGjEXsgfCSIAjMGu8jmgGiIpZ3MS+CATF1CnzKwX/+3ESriwUH1YniX/E2dvRM= 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=hR8dt4rq; 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=EY9Wac2DlK4bA/i30wmWrtcjkeSLXkLbt/c2rsE27CL4pQzhgo5fg2h6e/C9b7FU0Kx8dIWkCyemGLWmtzQWNX3eIva0QvftNhgavsVnXD8TAa4lRhfb2j96u8FsQF8e0Y6z5l3CEqh6+Q2WSxwth9hafDRdD1wrCHch2VnBgvZd6UocZ1fW6OFpXUtXbIAZ8y89qyXal3F5FktgWTg0oLmKnbbIrmy13LKu37CjO1D0t5q0maufSdXAhbE74zNcm5oH3i6Gj0/1sdoMgG6CEDtuV64pD/hugVc1giFX7zBz/64v13U4K9K+sEOuZkh50ufrJpFsFgA/Ivy1hCELtQ== 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=GJNf9BhDEBQw+QBjmIK43ZXJQ02KyxkOt212RsPDMms=; b=acDqjHsscYdRgRS1+k6rxHL6NLOBClreSxfZ9sVnRiHr5qCJLLsG0+AjgQfUiVmeyzBHAHAYh3cpwWcrgPKDKsyR5sz7LMYteC1YEzpEmW7+JgNTB7rPQyprIwXbWjbvUIaRoP/BtSBdvNOgvhtqSfKdAv9EtIwAwpRGBBmmz1k4HGhN3GQXFe3sLiKSudpUvs4mFLjD3ZlHMktROAUmPCbAgo8tNgOQmkpBb+4rRN8CMcjc9xdh5tx35Fwsi5ky1Zr1oa4ZAJlncDykTq2nPRN3NnhkICBT+d0qLD9KhAkrstv0K/oYYvc7eFVHiA9JcSBx4Dy5CYPTi3hkKFdkfw== 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=GJNf9BhDEBQw+QBjmIK43ZXJQ02KyxkOt212RsPDMms=; b=hR8dt4rqFahSat3A5hztYWEOH5uCwShoDEzwaN1ZUKZD1kNjI0JjBX9yj93brWW+epwezD28adqKpJo5qamiIBwFr5evnihCl4A4gyHcGCjcdziXpnd2MKz5GpS9STjMHBp36uAxX09QGpZaQOnYrL77KVaaQeRLK4tKP5CV0Abqs5VQ/85jc5NhMtY3GDfg8W6oUJbCPQaKYIYf99NonJRytx8HQl9yVGNCqk4EeskqQqysOAsxa8oG0fbEdlE7UAUPNC94QKiRdswrn2128O39UXU5Fb3UmGmCmyx1D42iezBs2EGtawMwEmE3k3KQ8Rf5Jp1BrokCh6EtiVfsig== 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:02 +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:02 +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 2/5] dm: add __send_empty_flush_bios() helper Date: Thu, 16 May 2024 12:02:31 +0800 Message-Id: <20240516040235.115651-3-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: 9af02178-02fe-423d-0bbe-08dc755d152b 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?HRy0chjtiArK8X0jhwlQ2a6K+uvXvVzlKMbG9GzI7BZWe74hEBJGZGbR8Bcn?= =?us-ascii?Q?HVIUxkFGRh8HgIyrHo38MGDXWQE3UmVmhg5t0IKMGtbq36r7/CZ121bLu/Cu?= =?us-ascii?Q?UOZIlgEt6SscB6oO7s070pH0LCdBnFu644UuPOEJ2BG13Rc7oY7ZE+I86Tf3?= =?us-ascii?Q?QfS5N4oOmIhrYfr7TUtQyphIge81dTbJ57RMSgYhkTQNBiRr6b1B7QvwSzeP?= =?us-ascii?Q?wHlXjp4yTQLlscy5oe9H0lVOT9XWsMcHlkcWKt/JdSbQE731Fc6YgteulBPs?= =?us-ascii?Q?DCm2/b8pMx6ISJXgAGLv95aVy9/mc6X2Q8+cpzyCQlgm3X8VksrW5xhrFOrY?= =?us-ascii?Q?qvqXr2omwhtOix+cUJU/edzrIZLJo1D9iul3LMpXfCezlLInPwNNT08PoUAb?= =?us-ascii?Q?XVaXV7l3ALEMPGFWhwg+D1huLzKtymJtdkjT/Q5xlWwdEKTKRNikbg0+d99R?= =?us-ascii?Q?1JRfUy5bQTeCDGAVafIrTZjhONPNWkiIdCQtrsrIylyMYaxdaoylbfrxdDRc?= =?us-ascii?Q?f7kFZr5rSk2iCzeznbs85uGO+fTGFOm4Bv9OpEQnx9S9If3DFugs1m4+Yez1?= =?us-ascii?Q?kd4x/gu4cRe6e3OH1caBOBFGM8jpsz/e4UZjXKjUjcyF6/z3NKubGveTnAFQ?= =?us-ascii?Q?JQufOe7Rg02prRVOEcmtyzte0VIFtoY7h+ReuYu1uF12rzATiefuOVS3efiB?= =?us-ascii?Q?9fAhNvcENpHIR1dslW8cDEwpKdNWXbZccCRrWxJfMvdttMLNl1sDF+PJCJqJ?= =?us-ascii?Q?hJHLu6bdiEFnVzjvG4xvuW6qsj1VYe7gyEPYxjYblWcCkl0bzKaeEo4792ol?= =?us-ascii?Q?7XyzfMZJd33r1mEIDLCMxoN7CL1ZbDHJ4crqhqNj0mSuu4hVpOJBb7t4h429?= =?us-ascii?Q?5IeSUwSKlWI06VaEQvwqWTzxduYt6pkD6YfsS7YdMoWy/tquNBeumCJgNtYp?= =?us-ascii?Q?om3fJfFkjxDs/QvLSD7A2BB/pgV2+mo8YRx+uXS/XG66WKoXosFSF7+W+gv0?= =?us-ascii?Q?aGZPl8J+GzebeEj+WIpI31BtTmmZrjxpee2pEV27/xfwqjKsglhM3ouePlGl?= =?us-ascii?Q?H3OwMRHU20nozHeAxAcgo16H18EYm9xCvB8jTuNccoPD/Zv7q61ns22zCQXD?= =?us-ascii?Q?fxFoAf5Ve44GVvz+fcpY2kksttH6/rpHkEgKQnY46HQ667I0rJStNiF1euji?= =?us-ascii?Q?kf8iuJ7aJRxssLob0jTDh8HsLApksOy2lTx+UO9kuIADtBem4hc4+5tL/MNq?= =?us-ascii?Q?eKr4h692yViMU9L9lH3o5cx+DPRypft1gIUiLBhET//NgJGk6YAQ+2oPk4zk?= =?us-ascii?Q?mSGg3/B1+rn5/1Gx1Q1brFtbMGGzqgoa/cuxv35qWH06YA=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?tmoC+OPnjyknlQ+qsjgJVYsGjTAxdXJF52nwIm79Fu6P65cJ7Duwookp1LOX?= =?us-ascii?Q?bxDOvvsEylslLplxeTfd/ul0ChG+OAaUTkCiHilIMpby1ux5qwK7jLasPyA6?= =?us-ascii?Q?GMmexPqajZVk78Bp0b+wsVMIfkjaiksrQMq5sktjTsV6tOJI867wT6wrOf8e?= =?us-ascii?Q?CPKpTnGS0PCIt4PDFgDELTI+9s3u6f3wrdcgNAOUbexdeweQMzcWGz2cg7zI?= =?us-ascii?Q?rNyc21rpvmEAcCNZ/jzUAN8MhPaJAzn6WaA2VB8anp+G1gJhIIei8un25Qi5?= =?us-ascii?Q?I9IEOy3KCqt1TXGb/+PlT9VHHIll/4lE8X8pngY8swtmKNohk8H5qNhvd4zO?= =?us-ascii?Q?m8gVF9isGAs9WXqlwL9eFg5M/ftQBOGV2xw+JJ8PplIQy2Asu9uWuLOGr4or?= =?us-ascii?Q?A97j9COdnJ85lINcnRfDh/JtXggc3hE9jz/PPmSXypyhgkq+OSWSwEBOfFRv?= =?us-ascii?Q?2SPhM2bGTWlRsAixgi90E/S9bTlipVLBzrCzgtO3Epcp70IG3eqkndQzZUMY?= =?us-ascii?Q?h9SLLm7ScSuK5k9KP6CQyMP6Bp8UoBXYv8DCg5wmLccpaIAw6A5+L2e/WK/s?= =?us-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3/gNg0ob4y4rc0HHEHPLKudOOON7rEdP7?= =?us-ascii?Q?H8e2KPsZX/PDfGSKq1UljDVDwPedi2ensYD3VbmzciDBNA9MMt1+OBL2PgcX?= =?us-ascii?Q?NKIdeiPpMVzDnDC3HtWx/P5Ll6ClhAGa6c1yGxx2?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9af02178-02fe-423d-0bbe-08dc755d152b 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:03:02.8870 (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: OvFOv1Wg3dEJcN7P/JnRcB2C5VLfYXA6dUr/72BT7Dlkz7BLVdEml0mrny6fSflkwY01a5sMR09lVkvGR44Xqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6807 There are no functional changes, the helper will be used in later patches. Signed-off-by: Yang Yang --- drivers/md/dm.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 56aa2a8b9d71..25215b93c3cf 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1543,6 +1543,20 @@ static unsigned int __send_duplicate_bios(struct clone_info *ci, struct dm_targe return ret; } +static void __send_empty_flush_bios(struct dm_table *t, struct dm_target *ti, + struct clone_info *ci) +{ + unsigned int bios; + + if (unlikely(ti->num_flush_bios == 0)) + return; + + atomic_add(ti->num_flush_bios, &ci->io->io_count); + bios = __send_duplicate_bios(ci, ti, ti->num_flush_bios, + NULL, GFP_NOWAIT); + atomic_sub(ti->num_flush_bios - bios, &ci->io->io_count); +} + static void __send_empty_flush(struct clone_info *ci) { struct dm_table *t = ci->map; @@ -1561,16 +1575,9 @@ static void __send_empty_flush(struct clone_info *ci) ci->io->tio.clone.bi_iter.bi_size = 0; for (unsigned int i = 0; i < t->num_targets; i++) { - unsigned int bios; struct dm_target *ti = dm_table_get_target(t, i); - if (unlikely(ti->num_flush_bios == 0)) - continue; - - atomic_add(ti->num_flush_bios, &ci->io->io_count); - bios = __send_duplicate_bios(ci, ti, ti->num_flush_bios, - NULL, GFP_NOWAIT); - atomic_sub(ti->num_flush_bios - bios, &ci->io->io_count); + __send_empty_flush_bios(t, ti, ci); } /* -- 2.34.1