From patchwork Thu Jan 25 10:42:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 191976 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp1553564dyi; Thu, 25 Jan 2024 02:54:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHe9kWYx5krpEbKfWw44OqqBuLT62Hhmr64r8zgsWe2o8ex/E89vxwVGKHY8LMvtSFG7WCu X-Received: by 2002:a17:907:20ee:b0:a31:13e3:9c7d with SMTP id rh14-20020a17090720ee00b00a3113e39c7dmr476706ejb.74.1706180052557; Thu, 25 Jan 2024 02:54:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706180052; cv=pass; d=google.com; s=arc-20160816; b=jLkH2bjfsfqiq51UwNHqNnM90CGsYCCDDn0W9o8eItNp+ha3TepilfaJLe5BhgW7jk 5qere2rcxMMeelEP+IXmp5d58Ah77Ww1T8ujYTjGYk6DEJv9OYmmSFiAl7sJbOBP7h1B ycNyzfcT6OHKoHnNRorg2Efepdi0qW1MxMa0QwQbKQhTg/Y+Pt6NNfWD0FfZGASgs65P 4QdtiqsOB/uz3rDahqQJVVtx3M2Q+OcarwgiXDTFK83qTDEyKrJ2lhoJk6Nzs3lfoDw1 GhH6mVAp8Koq56HyJp3XZsiyb18wBx1BP25iRzAp+u6R0imbGMIhppkH4IcL422PCVI7 C0Aw== 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=vj7zVyuKAH50TCb39cGflBVeMwo0/gcb8lyG5Xvn12M=; fh=AED2lrIQZhdppGHbaRrNz6/BI48B+mbutB2egpFPmJc=; b=w2DYO3Z4MzCzmsZ7oeOY/LvOp3+pUr70D/CijC6em5gASk/x2xi8525/3ApfTLBuMC fymKm+ZIihF5mGBEpjxf/sy6+ghrBz3DyU/BpC/yYEGiA5PaCObbfu84ELSMx4xLy1Zz eHOeGHngfJScw+8BvYuGGsX7hTorHvw1VkCvulPDpWpn1krd4eQD5W2Q2WfWqrLOQNTk lbLDon9Ael4Jbfu6L3tc4PP43baoaOa9sodqfnWkgFqd/mywbdXqBMG/xt1NAJ69hoXI yFWa8+ggr5Mj997bhbTYGpfXPCs3XU3cb6VaERQZVk0RCesK+PbLRObpemdnbllvykVQ V/+w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tiiyjDvd; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-38430-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38430-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id c16-20020a170906341000b00a313f7978c4si790496ejb.1028.2024.01.25.02.54.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 02:54:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38430-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tiiyjDvd; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-38430-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38430-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 am.mirrors.kernel.org (Postfix) with ESMTPS id F0D841F22851 for ; Thu, 25 Jan 2024 10:54:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3FD5D605B6; Thu, 25 Jan 2024 10:44:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tiiyjDvd" 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 5E64E604BC; Thu, 25 Jan 2024 10:44:20 +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=1706179460; cv=none; b=FWrqAj6+z/RRAxSmMp7zeLYvJTkTLKtjFFG0YHRsSihyMtzAID0iBxMV0iyEK3F+6SqFK2ge09gyceuX37IaXZNr7hEzPuay42aJ5W+7N9C7G3NXyXIwDMn4qA2CfjUW1UkzS8gsFH7Kxp48eeBXrDGrc5Y2RJsyH2HuNbff/nU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706179460; c=relaxed/simple; bh=30KJx0Hyv2s41cGRszMYoB7mdxNuB2UrCQt/ZqfUUKs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WqHdzpfksHTXzrIKxNOG5Lr5xcNWnhRBmuoznlLzsX9DJrbqVMdzFE/GsG0AdsEntnjqaXL/ALHCS/1xkvue7SiW9Vysbh3/MSkkx1H9Twxe50n4inYX4bNcx6gf96hoVd/lzTh6ei8d+tNCvb3tKUrbe9Ur5h5bwv5d5rJUuvk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tiiyjDvd; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98658C43141; Thu, 25 Jan 2024 10:44:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706179460; bh=30KJx0Hyv2s41cGRszMYoB7mdxNuB2UrCQt/ZqfUUKs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=tiiyjDvdbfKZx0exBt2/0RN//cStQCjFtnSPakaxjiqbG09QwFo18dipIHYu7nzxn RVwkrr5dktoACJi88yZZZ9/HdBEr6P3GkbdKOiUk+n5ZstTXnePmN6GpkM2K7hDVPx LH9pboX0utRBk1s/irQx+LbBWJpf5vAR4ARbUrw3AqHjbpvTEhu7xS8ossIVwbv/fu ogcFceg+N1ZNJXgWNskpnXHSSTB2X5Nw/htf4Yk9gn/ErCwg75B1ruqJyoi/RUopPR FbEjrWjNePswBEiH+qAOTDzd6cqovM4jzQVfGagjbGN7mPPG7xAvI7mpLZGaJPhazb hLdACVJxsLmOg== From: Jeff Layton Date: Thu, 25 Jan 2024 05:42:58 -0500 Subject: [PATCH v2 17/41] filelock: make locks_{insert,delete}_global_locks take file_lock_core arg Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240125-flsplit-v2-17-7485322b62c7@kernel.org> References: <20240125-flsplit-v2-0-7485322b62c7@kernel.org> In-Reply-To: <20240125-flsplit-v2-0-7485322b62c7@kernel.org> To: Christian Brauner , Alexander Viro , Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , David Howells , Marc Dionne , Xiubo Li , Ilya Dryomov , Alexander Aring , David Teigland , Miklos Szeredi , Andreas Gruenbacher , Trond Myklebust , Anna Schumaker , Chuck Lever , Neil Brown , Olga Kornievskaia , Dai Ngo , Tom Talpey , Jan Kara , Mark Fasheh , Joel Becker , Joseph Qi , Steve French , Paulo Alcantara , Shyam Prasad N , Namjae Jeon , Sergey Senozhatsky , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Ronnie Sahlberg Cc: linux-kernel@vger.kernel.org, v9fs@lists.linux.dev, linux-afs@lists.infradead.org, ceph-devel@vger.kernel.org, gfs2@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, ocfs2-devel@lists.linux.dev, linux-cifs@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2261; i=jlayton@kernel.org; h=from:subject:message-id; bh=30KJx0Hyv2s41cGRszMYoB7mdxNuB2UrCQt/ZqfUUKs=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlsjs8SdqxMRoDIm0JB0F9m6FWBPyTlwlnxaXNh stmXIt6zp+JAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZbI7PAAKCRAADmhBGVaC FaThD/40Eel9ws4bpv6pYZmYpdrd8jeJp98F+T2aA7ikIwzWJsKndDyk2Egd1khC7kp7criXZWY krm85yb2xHZQOmQf/65I+9iuO8dkgZX0fP/ApSqlVYuaPqEVNQfpOCv7EK7vt4XgUDBTnANna/s VAeGNE31T/jCfCNaJuyl99kSQY0TEYzBbZ1wFgODmNgtAUwkcQGh0Q+h587Ob/gLDKpGzC1Beiv hbHo1r6r3rLV3Ca/QTWQQps5FVrE6OEDI0YEp6P6paTU0rqH+LGTrECH65hSaY/SmYlR/2p5MwK mMWHnpaqxrBhhBANC8odgeQKG4T4FFtGoe1O0Sp6VB230qO8WJ1OcQAfzPb9ohfMwZyxtrEJzvO Dq8VeRwzGTjqfYe7ozmHCBLm8edr736h6MKUTPpTl3F2noKOg62yKz7sJTDhkwYnY00TOvQTRYJ DuApjYo3w6BpPZ9AEkFXTaV0GN6OCI18G0iiKUevHQRm4Ahrs8GFqBtmNj0ukxxpr3uwA0cISpY A0tNo4Bt2+aWAdVg2A5OlHrWd6PGiVmJbR3FtRi/kxP2fsHbzX76yBtPbYMrdGPOX00Ekh/UpNd Sm7ASI6azyN8L4WZus725Ekd+SPYNpoqUr4GqP6F7NNzHcDRYic/6hgKvLNo5vOGQdFamQlbYMa bdHjgLS82BZCPGA== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789059455041383411 X-GMAIL-MSGID: 1789059455041383411 Convert these functions to take a file_lock_core instead of a file_lock. Signed-off-by: Jeff Layton --- fs/locks.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/locks.c b/fs/locks.c index effe84f954f9..ad4bb9cd4c9d 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -596,20 +596,20 @@ static int posix_same_owner(struct file_lock_core *fl1, struct file_lock_core *f } /* Must be called with the flc_lock held! */ -static void locks_insert_global_locks(struct file_lock *fl) +static void locks_insert_global_locks(struct file_lock_core *flc) { struct file_lock_list_struct *fll = this_cpu_ptr(&file_lock_list); percpu_rwsem_assert_held(&file_rwsem); spin_lock(&fll->lock); - fl->fl_core.flc_link_cpu = smp_processor_id(); - hlist_add_head(&fl->fl_core.flc_link, &fll->hlist); + flc->flc_link_cpu = smp_processor_id(); + hlist_add_head(&flc->flc_link, &fll->hlist); spin_unlock(&fll->lock); } /* Must be called with the flc_lock held! */ -static void locks_delete_global_locks(struct file_lock *fl) +static void locks_delete_global_locks(struct file_lock_core *flc) { struct file_lock_list_struct *fll; @@ -620,12 +620,12 @@ static void locks_delete_global_locks(struct file_lock *fl) * is done while holding the flc_lock, and new insertions into the list * also require that it be held. */ - if (hlist_unhashed(&fl->fl_core.flc_link)) + if (hlist_unhashed(&flc->flc_link)) return; - fll = per_cpu_ptr(&file_lock_list, fl->fl_core.flc_link_cpu); + fll = per_cpu_ptr(&file_lock_list, flc->flc_link_cpu); spin_lock(&fll->lock); - hlist_del_init(&fl->fl_core.flc_link); + hlist_del_init(&flc->flc_link); spin_unlock(&fll->lock); } @@ -814,13 +814,13 @@ static void locks_insert_lock_ctx(struct file_lock *fl, struct list_head *before) { list_add_tail(&fl->fl_core.flc_list, before); - locks_insert_global_locks(fl); + locks_insert_global_locks(&fl->fl_core); } static void locks_unlink_lock_ctx(struct file_lock *fl) { - locks_delete_global_locks(fl); + locks_delete_global_locks(&fl->fl_core); list_del_init(&fl->fl_core.flc_list); locks_wake_up_blocks(fl); }