From patchwork Thu Nov 7 17:03:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13866759 Received: from outbound-ip168b.ess.barracuda.com (outbound-ip168b.ess.barracuda.com [209.222.82.102]) (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 4BB93216A00; Thu, 7 Nov 2024 17:04:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.102 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999079; cv=fail; b=RDfsG7EiymGhvGMiJX8S/VtMVUmT08vjBOu3l1NmPcPBlpq69Aunaitc24GssyHwaifmnrJ/9JJNG9Ey4as1hslnISXKytO1nPnyZMA1r5le7A8mS6B9qLuRjJghpwL2VCRaNKzj3Q7tAAf4R8oP+yvKe+FRYu9EYdBn0AXtGe4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999079; c=relaxed/simple; bh=ikGif04sjep7rEQpVSE2ac++O9XaMsyCGtY4Tkd2gKQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Moglyyw7PhIDzGw2OTldUOWOMUA0nQHYysUIW7n/NV4HCsFN5tC2H2XXzqOUAgtjQwZLkk5IWNzvRcNOAG+vxlyAGLn9l0U6m1TkkjYMABvai9thd/sj/tQwS0IDBMj9pSftaZnnGlLyxhrc+5f2CBnkoHKxKvOSwBxQIC4/hsM= 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=rnVQ75rQ; arc=fail smtp.client-ip=209.222.82.102 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="rnVQ75rQ" Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2043.outbound.protection.outlook.com [104.47.57.43]) by mx-outbound19-226.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 17:04:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BZ6l3VCk8cHszcGeoiriMmYMm0DFSBMITnflnyfo2+LYfd9HUs/R6Q00E+2A1xN6r6s3nbt0ii+sT+bl+6yabQs3WIc/4XzgTrV461pROgzH4zoO/kD9QvtNvkC6jfBGXNyzOx/0R5Z8abJpC8zdIImsd8lGErYaI1PeY1xIMw7FGX0ZePOIYvtYqM10Gz0XEsmFpyUrFyZsGjIC/svmHSpG2AvT1Z7qmA7lhCy+a1/Fa8U5/aLXbNxMmkM8V+yxtdhVvPs1ZNZ5XXjQ+ls9RezOw6K6wdftqt/co4wbmAiknnqp96AKCz4/R9ztl6h6LWq122ZuebA2LXctUYBjQg== 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=dlTPtALK3niaLVj2kv4g4nP435uSf0fpIWA5KQAMXQ0=; b=uJO3G9S9o627w9v0CEMi+e3n7iSBO1CoY8SKzl6k0CV1RuU4q7XWZt9f/hz/pFiz+fj7sLywgz2i2X0DJV35OD9/7qGpNyMPwr06+lqI+QM+s8tyukMpIxLqHkeczhAii2chlYuTD2+TP8ib2ocvWY6fkECNUV905Etls3wPT0ujtdzMM+mBWM5xtQHmwiJ3wKfRM5u/v6L5LjG1U11mJlKjFY1EtR6LhKwjhnGAoaDUwipIXF/RrKvWZlltIZ40abB/kRDa062anOjgquu+Sw/hpDu+9Njt+pi0ZnXVQu67IgdusjQk01gL1z5QUAEfuSeQ3GQKAadQo6HS46bcZQ== 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=dlTPtALK3niaLVj2kv4g4nP435uSf0fpIWA5KQAMXQ0=; b=rnVQ75rQIliOpLwg2r19vO6n6ZA1WYiJL1A7gVlEBLUGNopVsScBfsdksfHaDfPTGdHI0//M9PQT0J30VN1pNBtRFA4UrIXeCTKjOzQFSwDI4JHvisqw63fz6dQZ6iNimaVFF7/ndPRtFhwF7sXh1KC8NHUDd5XnKSQFSmHWU18= Received: from SJ0PR13CA0152.namprd13.prod.outlook.com (2603:10b6:a03:2c7::7) by LV3PR19MB8703.namprd19.prod.outlook.com (2603:10b6:408:26e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20; Thu, 7 Nov 2024 17:04:19 +0000 Received: from CO1PEPF000044EE.namprd05.prod.outlook.com (2603:10b6:a03:2c7:cafe::81) by SJ0PR13CA0152.outlook.office365.com (2603:10b6:a03:2c7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.10 via Frontend Transport; Thu, 7 Nov 2024 17:04:19 +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 CO1PEPF000044EE.mail.protection.outlook.com (10.167.241.68) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 17:04:18 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 1B47D7D; Thu, 7 Nov 2024 17:04:17 +0000 (UTC) From: Bernd Schubert Date: Thu, 07 Nov 2024 18:03:52 +0100 Subject: [PATCH RFC v5 08/16] fuse: Add fuse-io-uring handling into fuse_copy Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241107-fuse-uring-for-6-10-rfc4-v5-8-e8660a991499@ddn.com> References: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> In-Reply-To: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@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=1730999049; l=1731; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=ikGif04sjep7rEQpVSE2ac++O9XaMsyCGtY4Tkd2gKQ=; b=YUMvQYM7HsqSUNxBxsK3bpnaL3UEuzVyKv9wJeOzyr17zsxSPjGlSxKvRrK1qyMTWeAqky9DX 8tiNC6skGlEAMOHvjV3uweMR5nq+NVOij/wSXYBBeWnBwiwqkJBYDuk X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044EE:EE_|LV3PR19MB8703:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ba1a087-ec80-43ed-4952-08dcff4e37dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|7416014|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Ozde/ek0jCuVUPmJUTB68l2n2i2jCw+?= =?utf-8?q?Mp1TIJM4lB+e7skdqhBmH89ql8/y4WpkPVdrKQ3OOCpXzEvj6AFOXhpfSvmvOF99p?= =?utf-8?q?TjSX0zdgJQfe8eBojp2brnjV9WXWlVCfU1DfUcaMFvENZJeWfeZOXmUsTHVGaqaeS?= =?utf-8?q?X78TphqfU8UOq+76E386SLG53hPENuOmqpZlpiZJFyCknEyLSZJsCcU8GfGlvh1il?= =?utf-8?q?fbfYX85wXSUzhWTYTrRdsMN5kC33fyFo2YoxtnJ4YqCg/xdVzEIcR2CzgFRZafoRT?= =?utf-8?q?IhEC9FwPea9mTT0QKsXYVPMIhzmWl9bIOBQEN3YD2mZfI/3Gz060UrrZZTIj+9Pi3?= =?utf-8?q?UAkSP/ou70fatDwYcnTVWGkNt5ujKMZbSY5m40FO7/ofDsNO+yTC/vNHdDr1Wua7D?= =?utf-8?q?bzkENJtj8FK0ViMcGwkmyoGmnN8Nuy5Me5xigpn8Mm1OtGkWvxGt2TOn8JLou8+NL?= =?utf-8?q?WA2pBDQvVxlJ8r+PhyN3tQzIn16oPtRusWyIT4mGlyEFRgBuzl7XuPONtNDR8M45e?= =?utf-8?q?aWB4JseojaOxdsZ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L:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(7416014)(376014)(1800799024)(36860700013);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Q0bRsVKGefZl/tCPFD+oyxaIKznCf37dXObkb04xt2pRhd0DRMW6Eq8TZmP1Qcp40iBWR3fzBanpPp4uL/SV0gtiz0juFjS8nBbjriVMJV4CROWBHeSKLtLxyBraPxbU7vWqRpziMyADySI8au8DYOlWN+44U64oVtHp9h1aGe4iafubMl2X0gRZK1U45zAR+Xykm+SdX/6+hRB0G1O4lxcp/B5cOG2zU1i0OFGGgBqr5BetDrmYuUuUfrMzpC7Rrb1ZnLyC8NtlWH46rWoetjPYIkZCm9Avh9UeR8Z8+OvF1allhMmDMmzoul6YhcGcI30nUXeHPZPhiDvI+LJcEuzffXLd/2lftRcsS+vfZiwEeNtBCXJfbdvOROmWsQjre8+L2P2gEqfqBjqIjnEgnDcyLu1c7GE+QwyN3nMdk7V/CJUfcMkRFoAiQNssjkt6LZNJcVgAxeUpDW+1ecPaXBYuy7bVvch1ZoOVg5HoSbcsyB9dbiHIiSGNnEtiez1Ntn39HaYYrJmwU5JGs8+7D7jjsVhFKJvRsXbN9sFuMTo/QluDwFGEutVe4uojwmFKR1HrYLFGgoXq8EeWaqsiGNoi1cSgF9cwKrLLBZGj0+227RsuRxi4R/ZlTPN+1aaBmbB7+G0bhPem+S6sHr0Scg== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 17:04:18.8545 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1ba1a087-ec80-43ed-4952-08dcff4e37dc 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: CO1PEPF000044EE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR19MB8703 X-BESS-ID: 1730999068-105090-12691-30408-1 X-BESS-VER: 2019.1_20241029.2310 X-BESS-Apparent-Source-IP: 104.47.57.43 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZm5iZAVgZQMNHAMs3UyNQ80R xIJ6eZWRqmphqmJaYaGlpYJhmamSrVxgIAlFF8U0EAAAA= X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260269 [from cloudscan17-186.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/fuse_dev_i.h | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index f210f91a937b24e75a467e943cdec4581900e061..4ca67c8ae0e28072383478d6ee7ad7791566b6ce 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -738,6 +738,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; } @@ -1872,7 +1875,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/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)