Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp128935lqo; Thu, 16 May 2024 01:04:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXKMOiM08dc7Q12CbQK8cmk4Rc3rrV+bF1aPDPgBTawwDsvNOWl8Eajz3a2G965K1dOUtAhLmx4K00aAYgzLXnXumnNn8cGHT09a0BTdA== X-Google-Smtp-Source: AGHT+IHcdQYImQTr0XBekuMb9Miqvlu2fMfKiLdxz9HXNoH5VkQYDgFmlU0U8qL4z25/nBD6mBTH X-Received: by 2002:ac8:5f49:0:b0:43a:cbe7:3640 with SMTP id d75a77b69052e-43dfdaaa2c4mr249983291cf.17.1715846680021; Thu, 16 May 2024 01:04:40 -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 d75a77b69052e-43e3fcf3715si4956731cf.14.2024.05.16.01.04.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 01:04:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180731-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=I8rciYIY; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-180731-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180731-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 B0D871C21832 for ; Thu, 16 May 2024 08:04:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9A28213119D; Thu, 16 May 2024 08:04:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="I8rciYIY" 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 D051176C76 for ; Thu, 16 May 2024 08:04:09 +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=1715846651; cv=fail; b=XBKtn0cWc2f2v/OC5cG+I5wiE3h3EAaC7qRMFY7qXy8+ScpKwbsqAYklvPcXRZT5qcEmB7XVSf/S0UEvgBgVKkOuESO82i+ykWI8Ft/kmsByKVJ2pvJjTqfEpG8I83JfLncf1zPqH62tJeEpGr+iu19KMW4JIyushhgd5j1GXh0= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715846651; c=relaxed/simple; bh=Dd2Ne+wYYQlf67SHMr3G51DSNztSqYbRu48pXFAFIJc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=mY8VatvExAlj1e+rEZzfK37E8sezs44t5CvAlkvLhEtv4Pwb1azdOasVJCL8SpHFYjSuMWSkZGKWkXRTY8w8UMs4PEt9L2GjLYEnZ+snsXQLQmSiBIIpI6sdXCDn1KExxlaCHPUQYYk9axQB5t8PsbASeGw+EKEZYACYw681Tug= 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=I8rciYIY; 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=lqtGC6cM3RUAsKonEwvdk9UxBL7liSesnsVOSHsaKl0G30cLwIi6iENdpq+dN8QRSxZvl4jeaQ0vq81jlCjDLyp2iH5BCDlr00qRd8cVHAZz3iYdDvk1aqj/cybru38fozs1he7WZTtDH0viwEonnwUR3dbuzpHAoEIY8s7QAKxUi/YZrZ8SF+TFuLXwqxVUQ9cYrDwnfZoECxWyut9iwB4CElGDFjqWapC5H8RWi147yK0DjLaPfQdLRqqLBDIOfVkc7IItGLlaCVzVqFJ5sfmlrgZJhuWTobdN672eYfdTjVluwMF3DNnJNDLGQsZOZtgOUonF8Rdy9tB9oSqxdg== 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=BkmDZCeNY5XtEYH4GH/u8TNQHPE32bZjO6FY0M2jMFGYqIvBt7cZvnO1xp6vzNOdn2UulL/m5Re3Vjh0UA3rZ0e2vSAZg2WseVxdYnM5s8ZdYrJmzChqKQGxPLZWWFGZvfTzl/uP34ubOt7aG+5yBmvjD4KcyspKL0dLrBgeKix57qw4B9Wjjy/N7qZ4TvZLnbJ41NKRfCfXl9994CsyTk91w9A9BrvBlc0CKVZ9XT8T1MWsUhIlTkiMf1gOKa48LtDOPbKJpe5kmWlNGSIQ5Naa+xcdn9MSjsw8hl8Cf8S7ZKLQjlIn14hn+gF/gBlS9JCetXQnmEmgZ53UlB5+9A== 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=I8rciYIY/mCtXGfRV4qNlLGwQI7tzjHd1MHg3xtHdRomxN4Bdc+Kq3wwJZbocJa8jD7brZ4zz8wx9qyyvg/rPJZaBOqra2ZlP5ofoGPj7tHG0vbEFtYn5pDWxXMfzC7RyTE09IhgsL0wg9KtFJuBewIvEAr2Qbf3OUMxEFl9B5GY1nJjM4gznAxHCR2dvjryIxxXvr043mFqlo6EEGpLr6z+WGTHkzu35a16UCMyr2QfJjJj4hEDM0Ggvr8dJ46fHSMcg3tmCDVIujRwiHNrNnUIl2JM7We//V1Lx0Q9oHBnzygzOGpqsZtG3YgCE/TjAplmc5kbi3VQgdKruhO8EQ== 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:08 +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:08 +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 2/5] dm: add __send_empty_flush_bios() helper Date: Thu, 16 May 2024 16:03:15 +0800 Message-Id: <20240516080318.120231-3-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: 8ca4c8f2-ddd8-4f76-ddcb-08dc757ec345 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?G7D2cXRn8Id9QTO4f/3FIZITsY57g2pap/j6ByjzqLQYutJ3bClekVfrajeM?= =?us-ascii?Q?lFZ4CPDBUkplKZV4S+qYzIJp844THlOGea2pCUXkuN2o4fiTbVfEyOzDD3Pf?= =?us-ascii?Q?SB7o6xBL704drq4V/tnfX/EeGbUvLKyF9NC2KN2NWunKxDvfKEoCXEJ9CPcY?= =?us-ascii?Q?oCxCPbkRtl0G6KI+mIPOF7pq8xS24HKZq86dMCuMynPe1eJM0D9U+3yP6a6C?= =?us-ascii?Q?hjylkcHfPamxQRWmZ6/z4KGR56BapOFVf2pDqGc6OasoWxVNlFoA0LlJXkPD?= =?us-ascii?Q?8w0RW6w03iM4o9yojcDQIctHUK36ESm5vMN/EDy1Da6MT97WeUqQLCAeau1h?= =?us-ascii?Q?i6lPgMw6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ascii?Q?hff/27HsW7aLL62NnMGsQbolELwLv+WW86fKszP9j3/+q8EaRMlIkeCJW4Sd?= =?us-ascii?Q?+NSB/yyVG3GlTCKDrkUeBUUSEPdaY4N9ccfftcOhe3sq3g=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?4RRaSw4JvBuOZzLT9iHWltq3KEwRoI5TKJfVxa2x3gTKjVxS88GL1sbN7Gwd?= =?us-ascii?Q?XwKum1NMlt/bsf37MpDbFKcJppJMnHAloYTQD/0S9Q17P8Lp1WMllPROFbaB?= =?us-ascii?Q?UuE5Kbt3+IuuZ1Bf6Gt3nvGpljSkhBh4gv4KrFRNxDFBX/xt+WaN/KUBwQq1?= =?us-ascii?Q?azXr0Y/bRpCnFRglPn3BbMpAjICY4az6zdoeQ+SOnK1W7NP4AiJs3AYsuAZi?= =?us-ascii?Q?lXdbfKEwbfjKvzZPnBfXXFXeMRWzfYrxlIHWtManBdvt90V2I6ASJbpL2O1b?= =?us-ascii?Q?Xpi0AWvYS3Eh5UAFPKtKhbJ3oVEGwDtlvgqWUNilASSJYKFhDqqXvR86YB/s?= =?us-ascii?Q?95sIjM1ySL9v0gWaaT1AEpnS25bAhbHtJIW8syUkxWJ7xE8ubTnnWnU7BB1N?= =?us-ascii?Q?5AvEd0eh6fqzu7ZA0EKIfDGyCnwLwiXGXzhCMQM2eD8M46h0me7iJdsUIDIj?= =?us-ascii?Q?8brHV+2WQHUH/LKMvbmIugT0I1oVpt6mLL92rp/VU/n6m/CysztI3IaY6mWu?= =?us-ascii?Q?x1dW3wsm6O4zj1q5aoqqbKuHTQFKAZXR7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?PiLxD0rYA4ADbkXPHxiDvKbnXNqj/kTPTL8AWUMYY0/QRS7NiHoYYBA41x5x?= =?us-ascii?Q?iwo5NNDWKIDo72lqan42TTXchH5mG3N/JkmAsBkg1lHUn4nHEQ1815RNlh9S?= =?us-ascii?Q?6bh1iukiooauk0jIn2AjTSH2Te1KM2SY2sv6XTxv?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ca4c8f2-ddd8-4f76-ddcb-08dc757ec345 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:08.4038 (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: zYSe06esEtG9OasYnf3N/tRgFOdogdMsL8M9sIbJQAtl7vUZCW6xE59Fkm9YM7R3/zMAmZJ2/rdz83+xOo/o7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6830 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