From patchwork Thu Apr 3 20:22:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 14037568 Received: from outbound-ip191a.ess.barracuda.com (outbound-ip191a.ess.barracuda.com [209.222.82.58]) (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 BCE8B1EEA42 for ; Thu, 3 Apr 2025 20:23:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743711789; cv=fail; b=p/vUU0MrxcnGTrj0uq5SLTwLBFatS7Bzy7TTFRUjwiw8V0sXYQyWt30Ix+q4gKO87UYM98/sX/P/MU5qVu6QzODI7j5vV/ajHWRtFgS3A1VzvQ88EM4hxuvBofzzBvUImEBQYC5ZKBceYb/c2evewq3riqjd/r5ILJPn+JRnjA0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743711789; c=relaxed/simple; bh=t/qWU7S8DFwFw1ltRPZymLwhxW9CiMD3+kpjL0lZZRE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VOr0ytcrlJXuwFBDd8Yw8Ev4BEe6Uyc8lvJC3n7ozNMnNp6E2allN3xwhc7xO3FAFg4lwYkQbhvhJEpduKQiZkaVwFFKmtNIuMRSnl45qj0rvg1Hyqtmlj81HsHijKk/BZF9HSb8xjbFW3uU/uVCg0YbS08VWPjo1yRrnuY3wPE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=UFw5EabJ; arc=fail smtp.client-ip=209.222.82.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="UFw5EabJ" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by mx-outbound-ea41-28.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 03 Apr 2025 20:22:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tAq+Di/srMTgY3BTjjGyE+L0j6oijLzSW6+RtLIM66CiCMZgtWBsi+1BLHpUtj0GI4Lj1T7jbgIYt7qm12kFc1iUP/aWQxVKJXsf+E+8/kwJaBm0zYdlIjlSjhz5NOLi5DmmsnCfgc7Jt3VePKpEaNQb/oAokY7/P4z/kUhAI6qFJD4JkEjp+DIiUGAYOeoUS4miazHujCEkNacDvWZef9/GkKHVVgBWONgT8/q36hkpBvs66wLh/De6ovhHhQAYQtR/MNK3xV9lj/KLmNDT0X5BzZA60CKmoAMzVKzVOS2lvKq67d0xfK1rIXxDPHtjCpSy694QuCUkmRq+V62UZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=w9c4thro/65LNTQvw9TViG04eyuC/g4rHehyEfqiU64=; b=Uj02+7C/Fm2Az+rxA6jmptyn7woA4zcFbjdrKlJPDIxPtpJSRWKiZiJqr9zP6D5zLU3EiHRPPlp1WPC/JKbCF34be8f/aeEwyqn0u+vWuaI6+1/Sr6RHYHSfiy8lSJ7BIT09DJG4xVpqyxPMJLMEGqXFRclUMgSbrxYfUGNxStWHisI6V83tglgjUZ2V8tLRuJBBpf1p1/hKYgWFTGQ9SL2RbBcV+Z7XL2BzSZ5eOGteeZ8y0trnc+nh4Iipwj1uj2EpXSfVP+07E3XH7+WElCLWkzpGqI5axvB4DkxjFW25ccbPraLEzOAITOsXF657mGBUZVZJCIWBK8jFDNDMQA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w9c4thro/65LNTQvw9TViG04eyuC/g4rHehyEfqiU64=; b=UFw5EabJmN6Iy7nq7QvcYfC89u8e3wRZjcqxec0Lyfz8js7mHWOi8LZnKQhmVlvzZWcDouEAXp1Dh8gf1fT1YWWVRf+GVo5c8FnEQk8dMVjtJnt93vguJWyFReTize9gaBoCxn62Y339eAk8mRAKHRr2b0JU/cmgodDZRmDt5jM= Received: from CH2PR05CA0001.namprd05.prod.outlook.com (2603:10b6:610::14) by DS7PR19MB7700.namprd19.prod.outlook.com (2603:10b6:8:ed::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.44; Thu, 3 Apr 2025 20:22:53 +0000 Received: from CH2PEPF00000148.namprd02.prod.outlook.com (2603:10b6:610:0:cafe::14) by CH2PR05CA0001.outlook.office365.com (2603:10b6:610::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8606.22 via Frontend Transport; Thu, 3 Apr 2025 20:22:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CH2PEPF00000148.mail.protection.outlook.com (10.167.244.105) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8606.22 via Frontend Transport; Thu, 3 Apr 2025 20:22:52 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 6BE5D4A; Thu, 3 Apr 2025 20:22:51 +0000 (UTC) From: Bernd Schubert Date: Thu, 03 Apr 2025 22:22:47 +0200 Subject: [PATCH v3 3/4] fuse: {io-uring} Avoid _send code dup Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250403-fuse-io-uring-trace-points-v3-3-35340aa31d9c@ddn.com> References: <20250403-fuse-io-uring-trace-points-v3-0-35340aa31d9c@ddn.com> In-Reply-To: <20250403-fuse-io-uring-trace-points-v3-0-35340aa31d9c@ddn.com> To: Miklos Szeredi , Vivek Goyal , Stefan Hajnoczi , =?utf-8?q?Eugenio_P=C3=A9rez?= Cc: linux-fsdevel@vger.kernel.org, Joanne Koong , Josef Bacik , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1743711768; l=2416; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=t/qWU7S8DFwFw1ltRPZymLwhxW9CiMD3+kpjL0lZZRE=; b=Ur6Fs/0aGfQzjLuqRCfAz0BGAas2qgmgXsvNVyrOlP5i/xeKadLOcIIICg4GrjFKSww0LLW2S L3ZnxF2u9GQALSDhX7MJfOAl8MjDXFJvdJmp65KJ6aZ8/2DlSe8HpLa X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF00000148:EE_|DS7PR19MB7700:EE_ X-MS-Office365-Filtering-Correlation-Id: cb1a7910-dff4-4c28-b409-08dd72ed4f6d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?cBWe24LMh4usgjlw6lNxYm5l33UjqII?= =?utf-8?q?LuVxJEyciXpOsfyMzVaQ06Ne1ZpoYWDxi4QDAkekNfdCGQ2lrHzJ7JpYE9y238XLQ?= =?utf-8?q?TeSmTMPPcdVB3IpBxDSh8JymKqBQU0A/KbpdJjgyBhXmR+TDGMkIpQ3qQUEecRjfB?= =?utf-8?q?BwSmAxnsYojkVwbO2JPqZ8Rk2CDhqYHeLN7XYhKV1KMUUvq+SbJS17JFkc1bwq993?= =?utf-8?q?f731ZXYz68tmExdItFpdG7nU+h9OuFjPbg3asYibonTFc0P1+ro4htumilN3IBOu3?= =?utf-8?q?mzk6NCvWK7KUZwsQVsp1D7vj5m4wPIeCTVJVLgSUecyFASmtJ+Y2mdoYPVNBObAVN?= =?utf-8?q?63aCh57OmPXNXbub+PQzJTBXSTfRLDGQfOjdscn0vyNSfYnSphmEfzhEDStFPgXVx?= =?utf-8?q?JUDdEPvunKghnebVHvxXkL64/lOX4gaIYjScPdWRA3srkn58QB1poJ/pvPq9dckJS?= =?utf-8?q?ImCT+JlmG9D4HkB5GSbt0sLX8np32LhtmWRWpoEs1eWqCdF+yiRNNbzpPwtM37chr?= =?utf-8?q?FBMFh4PJ1GouB7oaIr5+jXeqcFhld3xyxaWX8cBBueYov7r9P+lJSLLIG8Cgvd59O?= =?utf-8?q?euNm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.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(36860700013)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 4+QbJzoANcAVfhh/vOQm3tiBUFQ4DPt9sx4vW6i2UJB397wv6CaQ/gjZy1PmLGHbK3+XS0Jecv2BhauQxkxQrTLnde51fQpmzZqb2YRzLNaFKONZzd+pcRWRCo6QFrZOzlKR6K2BZnma46NtWcLHb1BzYBcWzWpWT0MzkvH44fqVFm8Of1j6fYbxVZ8aOzkiX5dJS2SS+guQVRdofSXLDxWElyOgazZRdovlfiqH+jiWNJUTcu+TOA/wi66KV45zzyU+XXzyRJYqEa4ZGj3TswQkP1lKaaSt7z/TFtvgiM1KzHl3s+QLK5jlvkrJei+/Mo4LfV5qXJzIPP9Id20x5ook7sxslGOifJB8VdM0uBVG/AhdYEcqVwquAtSfMOrE0HLMWMM4ioBFtFLfCkmA2szEmc6sYw1cnHW27NrP3FpTAPur3ZQkF33vmxoEkW+M6TJw2ikssYe/0zWc0KZI1ZYoX5jnWSTbYI2BQEbREQIGGgDPmxPffsf9uQ9h05TYdn9RdNY8xjTH8GZMRVqWzvYUzkYerjAHaUt+qLzPROuF9C6YqMrk5XZ+Tz4dORv50ngHbWN738IkjY02ASA9urj4UFcEX+We+fzZjQzm2CGRvUUr2nZGCmHOs0z58mxt9fztHkP0xcLCUneUXMecxw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2025 20:22:52.0946 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cb1a7910-dff4-4c28-b409-08dd72ed4f6d X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: CH2PEPF00000148.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR19MB7700 X-BESS-ID: 1743711776-110524-1328-16626-1 X-BESS-VER: 2019.3_20250402.1543 X-BESS-Apparent-Source-IP: 104.47.56.168 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkbGxmZAVgZQ0CDZyMLE2MDUwC TR1DIxNc0gLTHVJNkyzcQ8ydQiycxSqTYWAKVqchFBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.263629 [from cloudscan20-57.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 fuse_uring_send_next_to_ring() can just call into fuse_uring_send and avoid code dup. Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 5a05b76249d6fe6214e948955f23eed1e40bb751..c5cb2aea75af523e22f539c8e18cfd0d6e771ffc 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -667,6 +667,20 @@ static int fuse_uring_prepare_send(struct fuse_ring_ent *ent, return err; } +static void fuse_uring_send(struct fuse_ring_ent *ent, struct io_uring_cmd *cmd, + ssize_t ret, unsigned int issue_flags) +{ + struct fuse_ring_queue *queue = ent->queue; + + spin_lock(&queue->lock); + ent->state = FRRS_USERSPACE; + list_move(&ent->list, &queue->ent_in_userspace); + ent->cmd = NULL; + spin_unlock(&queue->lock); + + io_uring_cmd_done(cmd, ret, 0, issue_flags); +} + /* * Write data to the ring buffer and send the request to userspace, * userspace will read it @@ -676,22 +690,13 @@ static int fuse_uring_send_next_to_ring(struct fuse_ring_ent *ent, struct fuse_req *req, unsigned int issue_flags) { - struct fuse_ring_queue *queue = ent->queue; int err; - struct io_uring_cmd *cmd; err = fuse_uring_prepare_send(ent, req); if (err) return err; - spin_lock(&queue->lock); - cmd = ent->cmd; - ent->cmd = NULL; - ent->state = FRRS_USERSPACE; - list_move(&ent->list, &queue->ent_in_userspace); - spin_unlock(&queue->lock); - - io_uring_cmd_done(cmd, 0, 0, issue_flags); + fuse_uring_send(ent, ent->cmd, 0, issue_flags); return 0; } @@ -1151,20 +1156,6 @@ int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) return -EIOCBQUEUED; } -static void fuse_uring_send(struct fuse_ring_ent *ent, struct io_uring_cmd *cmd, - ssize_t ret, unsigned int issue_flags) -{ - struct fuse_ring_queue *queue = ent->queue; - - spin_lock(&queue->lock); - ent->state = FRRS_USERSPACE; - list_move(&ent->list, &queue->ent_in_userspace); - ent->cmd = NULL; - spin_unlock(&queue->lock); - - io_uring_cmd_done(cmd, ret, 0, issue_flags); -} - /* * This prepares and sends the ring request in fuse-uring task context. * User buffers are not mapped yet - the application does not have permission