From patchwork Thu Nov 21 23:43:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13882460 Received: from outbound-ip191b.ess.barracuda.com (outbound-ip191b.ess.barracuda.com [209.222.82.124]) (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 010F31DE2DE for ; Thu, 21 Nov 2024 23:44:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.124 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732232656; cv=fail; b=n9I5XVYGzDd4qjAmn+wS7luQa3rODQ30gBHeFeIF096w+gJHHawQNIb7Ud+ou4C+gCwakqLCIuKjMz1WbyVbpoe/nSk/3nFrRuSNSZE/OvBtb3ybLMp/tl27imiHLGEhlezHVzrC9rQ/FZkN9QZb0ZPt7lP3xXxiXdemuOde5Fw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732232656; c=relaxed/simple; bh=5tWGsfFqIOTmbzCy1M1YG1Z+pGnTYUdhQKGU5bA4XN8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iIOya6dfB18fY/VKOPF9bXQcjXwFOKLes8+5NY8Px9N2btVsM8xoSbeCb92TBFLMugndT5lRNi6yM2kQjBF/dacqy2brCPwZ5qUO8FIOCN6NryBlgHbiRfi2vYC1aACjF4NXN93GTkVOsTwj9U+d9GpTdSiKi+MVTWQNu3j94A8= 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=j8pGNN3/; arc=fail smtp.client-ip=209.222.82.124 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="j8pGNN3/" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2049.outbound.protection.outlook.com [104.47.55.49]) by mx-outbound16-233.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 21 Nov 2024 23:44:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WJ3J2yk6S845xas7aiisHzTCX0vMg0Vq3hUadvIgE7uAhotfeL2juF3ZHkQPJf7aiePE+a6u8UXT8TO0m9V8/a2btp0fMQ8BxYgP2TcZkkUbdP2kGh8+Q++Nny9xRd23OodH1Rk7M1y1CDfqVjDaG2Yy3J771hqe7s2KZu+3dUrHG/2zuKx78lkoiKlQxTPfPXuN7sUUTVHcJSdjtt2AZiYM3ngVSckSqkfLzfw4VPVy3Y/xUQMxCB6WEeiBlpbvF1dWlfHN3hH7441pCeuz3ww1f1/G2GHbIeZfbPM/aKbjyvgUugSBHDPiEhDncjNm02AteKGEfMA0lOf7Opqg7Q== 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=ic1lWTx2sk0ToMWueKYzM4z+GqjslhRxPuaqXsC8MHM=; b=abaj4uw9vx3g52m0FKik5bthz6afvGZijrKf56upoe9zm7aMY0SJrKrPYKKKa7+ZsxENJr7tKaTyckwdBQPOt9YJfB5fzm0MC/YmH5+ygBTKZEnYuFcwD3qZMnNx8mOiYog2EohLuxjHMh3YtKD1ghriMgYQB7RKCEwb+Zg2Qt8koXjZnPSqCrsqGKUIrDyaondm3aDjqlhKalTRbZaLyChuXHjqvJG4VgjO7vHzBofXgKF9GRO+pTAfzw6t/Hwy/zNXNbWZBBVCoRLPjPaIhZuIOpel9IAgZORQci3dFwd3ToQP8bi5yhKdXYlRJDEY47ubjB5ZDdDeHmDPKx7MfA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.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=ic1lWTx2sk0ToMWueKYzM4z+GqjslhRxPuaqXsC8MHM=; b=j8pGNN3/DSizrzIdSrcj9x1aULBR7laLyECgVWshkJ9pODsDzlDz4hNpCRalQ0rwalUCwhA+TTmlKHTWMoSFJcTyTu4lQ/xGSsY6kJ0gyi/OLmrkaM36GAF3qTurvxAGts/aJ8/L0Kk4v+IxwHzP/UqDcAHV3eQcTYEqSzQmco8= Received: from DM5PR07CA0094.namprd07.prod.outlook.com (2603:10b6:4:ae::23) by BLAPR19MB4563.namprd19.prod.outlook.com (2603:10b6:208:293::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.14; Thu, 21 Nov 2024 23:43:58 +0000 Received: from CY4PEPF0000EDD7.namprd03.prod.outlook.com (2603:10b6:4:ae:cafe::7d) by DM5PR07CA0094.outlook.office365.com (2603:10b6:4:ae::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.24 via Frontend Transport; Thu, 21 Nov 2024 23:43:58 +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 CY4PEPF0000EDD7.mail.protection.outlook.com (10.167.241.203) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8182.16 via Frontend Transport; Thu, 21 Nov 2024 23:43:58 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id B75542D; Thu, 21 Nov 2024 23:43:57 +0000 (UTC) From: Bernd Schubert Date: Fri, 22 Nov 2024 00:43:24 +0100 Subject: [PATCH RFC v6 08/16] fuse: Add fuse-io-uring handling into fuse_copy Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241122-fuse-uring-for-6-10-rfc4-v6-8-28e6cdd0e914@ddn.com> References: <20241122-fuse-uring-for-6-10-rfc4-v6-0-28e6cdd0e914@ddn.com> In-Reply-To: <20241122-fuse-uring-for-6-10-rfc4-v6-0-28e6cdd0e914@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732232629; l=2481; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=5tWGsfFqIOTmbzCy1M1YG1Z+pGnTYUdhQKGU5bA4XN8=; b=pp/s7/6N4RG2lCoxWv1Xyaw1skp6Bq41fEnqQCizgByQlJG+DVCRO1TdySkBA5gx9WbnaizSO SYMdaNysGOgB5dD1JaYIk98em59/DC9pShRQktkPG3PR2ZtaYQnxjzc X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EDD7:EE_|BLAPR19MB4563:EE_ X-MS-Office365-Filtering-Correlation-Id: 749dd6aa-4728-4794-e2be-08dd0a865e99 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|82310400026|7416014|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?EYwJvsQh1jVfFJbrcp+c5wvwpN9WKT9?= =?utf-8?q?VK/XOpWcIts2gUzLijxsJIIWmVOwP5Gd7w3bj9vd+YAaHrfxRIa4ZcEx73Al94ud1?= =?utf-8?q?Z/tNko7aFPj+11B5Nn7RvgWcfabZ27vesxe471F35jzIaLOoqeL2e5WI1UvXgIdoM?= =?utf-8?q?DkQ2Ffp03Lk+idMMdd8oHxBNmNRmEwzIlgXrCUe/GRyUuYDXBtH9IThZIrithtpgE?= =?utf-8?q?U8A3hdyA7Iwihj6oCZW1xVA7njjlQ6wthiHYC3YvCQ+Mca9kw1mcpcVPH70wcdy13?= =?utf-8?q?57jhQkanEPpKZAFva6n3CcmFxJxhVN35eGtQ13hRYw6AihcF0ffps0YfCcMVovRAL?= =?utf-8?q?4AAU5XaA8YK4dZwosEYiSS+GJquSJM946+C4bv0ROzZ5UAG4ENtni2IClQI0vIixV?= =?utf-8?q?PKbc4dyTsKl8hJzz+YQl9Ihaq3fzQ9eKIozWJKZNPuOB4rCa5XOPjACe4/XJOZfSm?= =?utf-8?q?2C0WC8l7xcVWi+6ZvQl3CXDHc57VCoTFcgySbEOSK/ephMuekNwDbnBXSNUKM0D8J?= =?utf-8?q?6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RY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(82310400026)(7416014)(36860700013);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: vdjrY47o74wleiFj9FxxZNRLQDovu0JsbIIxgVKRGEjwja0+WN8x3DUfOPX7Qgmhsn7fqt7ieF1nGbH+zdQmbHpjklxUwqllT0b/X+7f4zfywU6L7LcXEACI8DMXe2zD2vDyDboUQrAGrh8R80V6xMZJeBekPfSlHrlibLrYJGL+VrpRdx2JcFmyLhtaZKVKaxOowoTPIvec3VyuxaxMalagR3MLeBXxT23NNy5PZpNirGisshvHgM6dBW3nGjvclQtnuwotfkdTtO5GFDQ8h1mA+2RzZ8k3tX9Mntt4BHIRdLqaFPFHzV6DgYJnyfjyVFFvkPNrtGLl5AnkWktWsYAVc0usN6/h67xwQkhTDf92MpaVcgdDPxOWHjFjPAatZBvhF7SvAqfiGwGmkUxKd3B7ukg5+F8/e0F0B4Q5dqIlyE96y0GBiXP1MR8Xi43RPSp+l2lvaswp+so9/YlUb5cFryz/8iY+zkdvwyOrGoMLryr8hxSMYwDP3dxZteCf98dM1fkBJoXSmjAGSM1lvZvjLRhn9neAYCeOTqaSITdBxNeMjOtkz+9Er5EDnLI/EoUIB4BeT3YT3k9C1lpwPTIPamMv84J6WCOAu+M52lAEQZSQ+J/eJwQ6AoJec62P4ORkmxcKLIcrW3mowAnv4g== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2024 23:43:58.4892 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 749dd6aa-4728-4794-e2be-08dd0a865e99 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: CY4PEPF0000EDD7.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR19MB4563 X-BESS-ID: 1732232642-104329-12100-10077-1 X-BESS-VER: 2019.1_20241121.1615 X-BESS-Apparent-Source-IP: 104.47.55.49 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkYmBkZAVgZQMNU0NcXcxNLIwt jCPDE1JSk5KcXSJNUiOTXNxCzN0jBJqTYWAO1Q/MZBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260587 [from cloudscan20-2.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 Add special fuse-io-uring into the fuse argument copy handler. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 12 +++++++++++- fs/fuse/dev_uring_i.h | 6 +++--- fs/fuse/fuse_dev_i.h | 5 +++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index aa654989d768df3dd82690ef071bbe0aa87817b0..ad65ede9c7723bb6f3589e64b8eef7429fa4b488 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -787,6 +787,9 @@ static int fuse_copy_do(struct fuse_copy_state *cs, void **val, unsigned *size) *size -= ncpy; cs->len -= ncpy; cs->offset += ncpy; + if (cs->is_uring) + cs->ring.offset += ncpy; + return ncpy; } @@ -1926,7 +1929,14 @@ static struct fuse_req *request_find(struct fuse_pqueue *fpq, u64 unique) int fuse_copy_out_args(struct fuse_copy_state *cs, struct fuse_args *args, unsigned nbytes) { - unsigned reqsize = sizeof(struct fuse_out_header); + + unsigned int reqsize = 0; + + /* + * Uring has all headers separated from args - args is payload only + */ + if (!cs->is_uring) + reqsize = sizeof(struct fuse_out_header); reqsize += fuse_len_args(args->out_numargs, args->out_args); diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index fab6f2a6c14b9de0aa8ec525ab17e59315c31e6a..17767e373d31969fe2987fed31c66b5077f209c6 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -14,13 +14,13 @@ enum fuse_ring_req_state { FRRS_INVALID = 0, - /* ring entry received from userspace and it being processed */ + /* The ring entry received from userspace and it being processed */ FRRS_COMMIT, - /* The ring request waits for a new fuse request */ + /* The ring entry is waiting for new fuse requests */ FRRS_WAIT, - /* request is in or on the way to user space */ + /* The ring entry is in or on the way to user space */ FRRS_USERSPACE, }; diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index f36e304cd62c8302aed95de89926fc894f602cfd..7ecb103af6f0feca99eb8940872c6a5ccf2e5186 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -28,6 +28,11 @@ struct fuse_copy_state { unsigned int len; unsigned int offset; unsigned int move_pages:1; + unsigned int is_uring:1; + struct { + /* overall offset with the user buffer */ + unsigned int offset; + } ring; }; static inline struct fuse_dev *fuse_get_dev(struct file *file)