From patchwork Wed Oct 16 00:05:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13837494 Received: from outbound-ip168a.ess.barracuda.com (outbound-ip168a.ess.barracuda.com [209.222.82.36]) (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 91C7E10A0E for ; Wed, 16 Oct 2024 00:37:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.36 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729039060; cv=fail; b=uXbIWEhut5Hx7gmm/3+lES3bV4VT00T+EofrhmyVoMtXdTba5sHlBaM9HACrpR2toj7dNF7zzFQx9LMfe/X8abQJLJ6i319yBaOWM0psRyJQfT3zTxR04i9FUXhhb55pOrlOMc6g5lDtVdhTqRYCEzLLpkB1iN1xql3We7gZT1c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729039060; c=relaxed/simple; bh=pNuXHqYBMelL+iq3r157MkqfPX8Plp4UFsidoOeclY4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=B7rpvcwjuMzBZtchu8XYb7GC9YFVGTazdXe5R6/hrXXo3TNvxecXsrZE7TpeRXaGyl2L48WK/hNX1NVxcU9AhWFa3n8UDSyOtlNOP15yINVWNAef4eR6DMxUbIc9yNZq+39Eh1++hKdPrysXrhvgGkJRVb+G/fECxATFO7gYUAg= 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=HnBfLGNA; arc=fail smtp.client-ip=209.222.82.36 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="HnBfLGNA" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2048.outbound.protection.outlook.com [104.47.55.48]) by mx-outbound10-224.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Oct 2024 00:37:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=G4gq17YjXqrfsMwEQjBu9urn9VN/oXK4qoo8ZOWrk8yDeJblgrIEVenmWt+QALcLbP/RliGpEpLD3xQdvhy8cF67btso4dVLRkOvMnhDAWqwg6Lufh97FTAWLiwCH3/wylRNEDSUO+yD7QydHP4jl0l/ZA3dGY8uIXhgzFiJEp2i2hU5nZCF2Cq0qvpZpQOQStxC/13L4bN94urFRc6+K7iUCgAb9/1+93j++AzjcG7zPJr3L8WblnL2rJPSBOtZ4PPdAq2yxOK68hlYeHPFPMfUPXpMV6NYBe8hMzRGAtwYHRTXU31KNq4EuLoRbP36zOPy0qEFJmJ7/xCmt3nSrg== 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=VfnHHdzb39eJZ8k53FfikwN0df4vGqbRyNXofbLxbVg=; b=uR1CsDO6Nx71r2dbu7om5VCi+816gjpq50tNHS4ufkLJbOCUhpSvK1PW1SDLD8+uf4MoOuuC4GQcVWtemTDflkwJKRKzyRqpoTvURAW6EcDKNPiZ0Ys9SbvBFwjufQdUMWCJGVdHWAAwwlQ2dwOg0phiunflZAj26iXerTYElMR3iU2OILhgaFqPVn5O7kzqtsgYzExm/Nuj8ZebtB5LcXOQnKQcUiftKoRaJRljVUtcHbfUCfNyw7FcPkVVz+7As4/y3WSJqLrjawCFQamWKago/QuB6x+h1zga3z9NfKN1uQf+5QA87sQ6udMw6225NLVn1lVnezA417SmXiNlSQ== 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=VfnHHdzb39eJZ8k53FfikwN0df4vGqbRyNXofbLxbVg=; b=HnBfLGNAmdH798l5cr7Jx0HQ7+FG1o4G075mRREg8JxkhfiZW8U95SePLKzgk3HaJc4TiHrrf6kRv4pKthLYp04A9zCmNRku6fP7GaXplz2q/2XXIiCLuh/MCywfkgU7kTvyMFmiqHOfi/vAaFBy1v257nNXJGPOstQZQadIDPY= Received: from MN2PR14CA0028.namprd14.prod.outlook.com (2603:10b6:208:23e::33) by LV8PR19MB8352.namprd19.prod.outlook.com (2603:10b6:408:201::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Wed, 16 Oct 2024 00:05:32 +0000 Received: from BN1PEPF00004686.namprd03.prod.outlook.com (2603:10b6:208:23e:cafe::59) by MN2PR14CA0028.outlook.office365.com (2603:10b6:208:23e::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:32 +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 BN1PEPF00004686.mail.protection.outlook.com (10.167.243.91) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:31 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 9FFD97D; Wed, 16 Oct 2024 00:05:30 +0000 (UTC) From: Bernd Schubert Date: Wed, 16 Oct 2024 02:05:19 +0200 Subject: [PATCH RFC v4 07/15] fuse: Add buffer offset for uring into fuse_copy_state Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241016-fuse-uring-for-6-10-rfc4-v4-7-9739c753666e@ddn.com> References: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> In-Reply-To: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Amir Goldstein , Ming Lei , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729037122; l=1743; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=pNuXHqYBMelL+iq3r157MkqfPX8Plp4UFsidoOeclY4=; b=aqaW2yUyFQ2jU2qooXUHW2BixrNMMde6j3r6zW14Uyd36u8EWqXYPN0ySCga/N/dNwDDgcrSN t/J09wl/J3uCN7+C++32Sn5cTJ1NIacVh/DzTf3IOPWCUu/j/sUgWQq X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004686:EE_|LV8PR19MB8352:EE_ X-MS-Office365-Filtering-Correlation-Id: 6ad4e6f0-c704-4797-576c-08dced76403b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?PHYfetgihCxePjkU7JpFeqOAAh0dNsT?= =?utf-8?q?mMwJK7EZMx3r4naGOKVXZwmQcNQycuZDRL++MGrLHkZcgF/gMY2TVVn1mYQgBl5Bt?= =?utf-8?q?nSc6fKyyLW0Zeojj3gJuDoUgX4vl+xs4YkNG0QnOdnu6Ti21kCty25lgt7I1Qjs1r?= =?utf-8?q?8Y9sySYZtBFrf+Abkdidkbd6LvqDzGUdMNvBaMfU4ROFnrwnoObFaWodHx3QaXNsw?= =?utf-8?q?4LqLChHV0gxa/8A8kVwH6PDfZPrDTFWhvW2qwVuPPJZcswthIaO+lsHlvf7jMqhAW?= =?utf-8?q?sCMNOGFz4XrwTm3fc1XKIygckLgslgKLRQ9liklOIhrju8zaX8Ud7qQX3E2d9oeRX?= =?utf-8?q?e7tp2bJMi0fHzwov1V+fpHulBDPKVlzUdsuzVxpMHU6jKKVxXNwk5WQIQw74ScL28?= =?utf-8?q?SGtrgC/Gi/jcEKMCJ121Vdaw0qhGLsjj6mEmEZK4jRY3WkGDY2o49Omjzyyw5ZtX8?= =?utf-8?q?4906gfof7V3Q26eEwyKcPG2lOWxch4IPPDefPUHmTtMDbUxrd3xlG0Xf071sg5ZKS?= =?utf-8?q?K9rmX1DlmX1fpFKo5nWhu455M1QJJinJdN8Irkx2GpT723mWldS6sysI+v5VDNHwp?= =?utf-8?q?yl12HRL+x1wdp6J2zbiTEydH7pB2ijQodUMDOPSCQt3k/WY/cjew/C4O7KcJy2gTW?= =?utf-8?q?01TVBwDnS3rFdf2iB4cvkOy0OGli2Km/UWVuDkSJ08GjNwYm4Jr/8qsWOrDnwKMY5?= =?utf-8?q?AEPju7ffrDAC7gvfnMwuXXHoHyqeZv1X4BQ4yZY+Qa565BMyWN1LKPA2OPdWIoAed?= =?utf-8?q?VmjJuw4O1sEafoWdGfHeU93WFu0i7LGP03vyXfc1HNOW5eAWSi5AvltPD9dqsiAe0?= =?utf-8?q?9zVWgwXpUno+HpOtvKRm5DBydysLGx9ZkCjijRoPEdxhAa3fpYkaORTKeb/HcY311?= =?utf-8?q?cs05oiRvB5LHJZGKV0G/po2PjFYHOetuo3uAkc1UqncDBfHntawGBS1x734YFPOYg?= =?utf-8?q?Rw0I5bGOZHZfr+k3CZ0uAzOH/hZ9aehg8HD295LrzEC6ohoC/EWjSfULNQjlQhFLV?= =?utf-8?q?Y9h80EjrsvOCxY+iVCalpSRzYZcpFuFuQmp0iWrddtvd5GUjS4HDFeMNbycxrlhKo?= =?utf-8?q?hy4ShSCUWFc/fklXYEcwJyGemDzmYBvx/zaDsSlb4fwGlh/EFS6oFqw+zoWlVi1P2?= =?utf-8?q?xxqEkdzNL5wg+V0kpdlYNtUcRXH8Fk+QUCm9NQtlCA+3XnL62HFJTijmdDXGDI76X?= =?utf-8?q?VCbBicX+6rVTajlF94xVA13VxAaIXzh96rAmav8tvtbhFUOfxbFp250dUkUcNV+qv?= =?utf-8?q?oY+MKyCiyf8xRyBVmVlgoDdkG+k/VEopUiIDHeSfkKwU+5dH+qYL5N2ubOfXD5Zrf?= =?utf-8?q?6H2DClOeiJcm?= X-Forefront-Antispam-Report: CIP:50.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)(1800799024)(36860700013)(82310400026)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: P6HNpNvOOQ15XjSwEk1nsve2FJ4Z0d8XPYXxwXN/JE/Ln9Q68xmrpBRQNYu4nW5tuTWqiXBVew1pdVH50Dx9WAfndh/onMMW2/XqA3iFxbHzQ5ILnjGkm98YYudE6K+jYZCSyepu/SA8IzOM4ZbS0IVB7KbfcBEh2PUhh+kvqgiAWskiJmAcBQ/HGUW2/duN9otifNffz0SZm5DFzh1R1AucaYmyvl1AGaGKzBmouEnrig867dZoYB9z7pdDaD399ObopEOY1fF/7W/Zy5w6EmMIYCDoHAPE3d6YJMnQ2NmeSghHqmPmTbvgqMi9gc+9PuHzHbuIs0/rZEQeP74V0OJVFpyVAf7oXr+nbu3MbMM75izFOYeeihylISc6NDRX1t720T5TVWrezGlL6qVMaCauQxSeyxDglJJp0qN23ubMCQpQOBdHFfvRT9bCZQ+QrcK9jrsq0q/wjoR/dyTQBpx/QYR2iHTy+6eDALPSjamaYSbaYu5AddFWiEb90GtAkDIYceykE470yVWLvbJLcMta7MK9fkdujq/pNESmRBx1uNmJ4G8s9sIYXJ38yHTRfgdn+7GeaGypw62vOgSFWB4eK3lJSUE/ZnmAnbgJtKMpZnDzkZmkMKWF8HW7vvfDSVC7a5qlcPufkroqRH2GJg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 00:05:31.7760 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6ad4e6f0-c704-4797-576c-08dced76403b 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: BN1PEPF00004686.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR19MB8352 X-OriginatorOrg: ddn.com X-BESS-ID: 1729039056-102784-8768-66017-1 X-BESS-VER: 2019.1_20241015.1627 X-BESS-Apparent-Source-IP: 104.47.55.48 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZmFmZAVgZQMCnNzDLRKCXV1D DZ3NTcKM3Y0tTMyMDCxMIkySINiJRqYwGzmMVrQQAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259752 [from cloudscan16-20.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_SC0_MISMATCH_TO META: Envelope rcpt doesn't match header 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_SC0_MISMATCH_TO, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This is to know the size of the overall copy. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 13 ++++++++++++- fs/fuse/fuse_dev_i.h | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index dc4e0f787159a0ce28d29d410f23120aa55cad53..12836b44de9164e750f2a5f4c4d78c5c934a32b4 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; } @@ -1856,7 +1859,15 @@ 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 the out header outside of args + * XXX: This uring exception will probably change + */ + 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)