From patchwork Wed Jan 31 23:02:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 195082 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:106:209c:c626 with SMTP id mn5csp98268dyc; Wed, 31 Jan 2024 15:51:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IE+eSIctSGWCUB5QE5GDXToOwUCXdW7nI0htKze277qguTQ1cc95XolpemQ47/CmFrWzhiQ X-Received: by 2002:a05:6358:261c:b0:176:a5c2:8f19 with SMTP id l28-20020a056358261c00b00176a5c28f19mr3405874rwc.30.1706745065859; Wed, 31 Jan 2024 15:51:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706745065; cv=pass; d=google.com; s=arc-20160816; b=EdbymrF5SD6lb4K1r9MxQxgvej9nsfi6g1og2pGPs8FNuER/sOa3lp1/D6hmOnb/o6 ETq1NHpCBGDAEltcy9ZHQsEdpHM6cBfRx1wG9m6wMZVXmSSztQFbCq5K9eSeshAfdysj dbYsmQGiSG4zxMtnKcBiGaEOJuYHMo8wK7x7Nedft3EJzhaKrBt9ouVAhCStrz+gss5w NVUHTEjiqhqSN53Uqjk+eC1Hk3/iqBSVT3g8EfU4UPmgZv1GLlPPeJlDH3JCfeLF6GMG Bwy6scky+FKB/Ws8Cf1SOIdv0q5aPEfDzcsIOSTu79BDpM/5Ra2DpZPKMrV/kqr+SUWE w5RA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=fzpUNrRSCzRQHffpMufJErR8UL8Vk8JNYbgOUANH7Wc=; fh=jzdVscR/b6WfBH5/+GG69ycKBkWePh8xzRqDU9IfNAw=; b=P8i4yzd4mlJIcnyGEDsb4D0InYEipAT2teYY9LlgE7BrXhve9S0Z2XJxbDVJbfuS8r ncIG0WHYENPqt7kddvKixU7Vx9/lWue0JtwN5V2VC1Bji5IFhP2y4qRfDztrmS3U5ity ZdVhNyKMxWptATU1GbFPrh+W1V3GlGy6g7fcy3Kag0VeSZaW7jLzeNQozGWCa8Ok6IOr aXUPnmuHee+VhkOnp/ZO6hijxCckcxrDtvX42pnwpRJTuvzEYUx7AKQR6qPLUm4MZJB9 FnbJjzuOEw5d2zkvC/FujBRYm30WN2U3dbn1JIWtt6CK4n4Q1L3vZqgdSqmCPCcnfNUz 0aSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bo39O7QM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47316-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47316-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCVtILqFO5cOxcYiTGimJMMVV36eRKZAvtqzD8BJOGH89hOdW5yof9ziB090/k39RTdI0qzmVODoK+BsvaprG4wugsEIoA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id l17-20020a635b51000000b005aaab9e7bcfsi10534689pgm.388.2024.01.31.15.51.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 15:51:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47316-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bo39O7QM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47316-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47316-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 1F115B312F7 for ; Wed, 31 Jan 2024 23:16:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F549144633; Wed, 31 Jan 2024 23:04:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bo39O7QM" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A80041420DD; Wed, 31 Jan 2024 23:04:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706742251; cv=none; b=gHFhEhTKe3ZksAZXSoMNHdOU0wYzySLt13unr34xFmo41YZhqlcR919RJRSU0e2L9rDmXk7cIpylRcxmg8KmW1a2BrcJjfF2Aw+fo+2CrXrEe0U4aJq4fJnk9eigbeRdT4O5FisVOnQyeeNjLxwyd/XCyP7kBHLBDnOppDzNi68= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706742251; c=relaxed/simple; bh=FAQxHdV1+8yfMKT7VO4N3syoGgU+YBY/HWjJUz0wdUA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XO9T0xTN/6Kzc2PHR1wc63Z5dOpdjWgC/ObebVellMnCef9k+LFVfZSiWU1ZdDMkkQV+WWX+BVFB+BcYAy3RL50i9zShH66Gb92myl24SOIZnxi3ZuxTR2AJP+vFMIJeU4Ab/uumjLMXvoSRzIF+QOVPzOPBtyQrVEl89Xldab8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bo39O7QM; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C234AC433C7; Wed, 31 Jan 2024 23:04:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706742251; bh=FAQxHdV1+8yfMKT7VO4N3syoGgU+YBY/HWjJUz0wdUA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=bo39O7QMEzMLWtvIFToHmul4LRH9khxR0VI53DJsD/BjRNEUYbtj/PkM54GRUXhs9 F99vQsM84BZWn0rRZXSg0cwHLy/SXbziPstA+lT57hYFe+4irz57vYAQfVHX8enPQo h10U2GTJMzj/mMgV6Vy+QDdQJyMRy9je8VpjpXwK6S70aeYJc0xJckUkDPjjSqmCpW aTn7b0sTpNINIby+DNGVhXtX8S0JUNVGATW3tZY/clQuCP9SjprLFyvAVvow1QQsoS 2zL0oQXquzZg6+tKvNeN1zgEGeNB1TYsO8s0F5G6R1WhNOxI4Lm6umdrBD+67+2hm7 DD68k3sZPH1AQ== From: Jeff Layton Date: Wed, 31 Jan 2024 18:02:10 -0500 Subject: [PATCH v3 29/47] filelock: make assign_type helper take a file_lock_core pointer Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240131-flsplit-v3-29-c6129007ee8d@kernel.org> References: <20240131-flsplit-v3-0-c6129007ee8d@kernel.org> In-Reply-To: <20240131-flsplit-v3-0-c6129007ee8d@kernel.org> To: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Chuck Lever , Alexander Viro , Christian Brauner , Jan Kara , Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , David Howells , Marc Dionne , Xiubo Li , Ilya Dryomov , Alexander Aring , David Teigland , Andreas Gruenbacher , Neil Brown , Olga Kornievskaia , Dai Ngo , Tom Talpey , Trond Myklebust , Anna Schumaker , Mark Fasheh , Joel Becker , Joseph Qi , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Namjae Jeon , Sergey Senozhatsky , Miklos Szeredi Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, v9fs@lists.linux.dev, linux-afs@lists.infradead.org, ceph-devel@vger.kernel.org, gfs2@lists.linux.dev, linux-nfs@vger.kernel.org, ocfs2-devel@lists.linux.dev, linux-cifs@vger.kernel.org, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1710; i=jlayton@kernel.org; h=from:subject:message-id; bh=FAQxHdV1+8yfMKT7VO4N3syoGgU+YBY/HWjJUz0wdUA=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlutFxf1cnuwYroAwFYo2+KfzrTvVzYQc5Fr1N5 krCEWo0jNOJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZbrRcQAKCRAADmhBGVaC Fb7bD/9VC2nnAzFcTcehbut8DHNauWiIU2fl0sOM+qOVaJCMVZRSnuNs3nps0oeNvXiWKOj0nRW RKqO7ghoU1qGCsGe4gtk8WtO/saWLcEKPf/2HzTUctSpB5L51DJiPjQ6oT3fXCRm8Aicguf+WSK RtuVqeut2yt9Bsl4UqpsJrierRVSXUaJtvc7yGyaf06VJUvPPg/eBjY7Y78C1of+N1SnR1kLGmz i+jhtIPiT0W9gMdcJ5EB6nsTq8Hz0Iv8yySlHJlNWzX0RJVTlUNYPKFEbWhiMn4Rpd+G8OoQDjy rJQS36sO9gxdLKEpdh8Iril8xhlyawffnG1peq/jfbSLUo4cTcysKZlc2AhOmtQ6lF8x3QsXg9p x1yscVmwaceDVXbn/ztEoA/0Q86+PqVdx2Y1Jr+xynVZ6JQakAo4JBBKFLc5eTmzNhCxoGjGpoo wVtdOD1SaLoJCptqPHd5e63zdASzvxIxjARki/ZhtaHZ08H7LNOwl12wpCTJv45IYoRlflRBvR2 2mAXiSyQwg9j6TmNLpBKI90Ws2Lz00AXWhNk0jtry4qNqxkNpbJcNYafavngTYFBxh1wiwVszi+ QKKyKed6XR0zbbMtEwXdDc42qu5+IlGOmnA86tK1IUHF+7y5QaZQtvzDONycBdKlXNoRAiB8lZ/ e+uN3ahVzjwYn4Q== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789651914016817138 X-GMAIL-MSGID: 1789651914016817138 Have assign_type take struct file_lock_core instead of file_lock. Signed-off-by: Jeff Layton --- fs/locks.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/locks.c b/fs/locks.c index c8fd2964dd98..6892511ed89b 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -439,13 +439,13 @@ static void flock_make_lock(struct file *filp, struct file_lock *fl, int type) fl->fl_end = OFFSET_MAX; } -static int assign_type(struct file_lock *fl, int type) +static int assign_type(struct file_lock_core *flc, int type) { switch (type) { case F_RDLCK: case F_WRLCK: case F_UNLCK: - fl->c.flc_type = type; + flc->flc_type = type; break; default: return -EINVAL; @@ -497,7 +497,7 @@ static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl, fl->fl_ops = NULL; fl->fl_lmops = NULL; - return assign_type(fl, l->l_type); + return assign_type(&fl->c, l->l_type); } /* Verify a "struct flock" and copy it to a "struct file_lock" as a POSIX @@ -552,7 +552,7 @@ static const struct lock_manager_operations lease_manager_ops = { */ static int lease_init(struct file *filp, int type, struct file_lock *fl) { - if (assign_type(fl, type) != 0) + if (assign_type(&fl->c, type) != 0) return -EINVAL; fl->c.flc_owner = filp; @@ -1409,7 +1409,7 @@ static void lease_clear_pending(struct file_lock *fl, int arg) /* We already had a lease on this file; just change its type */ int lease_modify(struct file_lock *fl, int arg, struct list_head *dispose) { - int error = assign_type(fl, arg); + int error = assign_type(&fl->c, arg); if (error) return error;