Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1969049rdb; Wed, 31 Jan 2024 15:14:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IGRson6fP1Fve/dPXyeKHEdS1vtDKZvza7s4IRl+p4pKPAhP3DLU3AZq6+z2HTA00t2GnPC X-Received: by 2002:a37:ef0b:0:b0:783:e114:2a62 with SMTP id j11-20020a37ef0b000000b00783e1142a62mr658474qkk.16.1706742885686; Wed, 31 Jan 2024 15:14:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706742885; cv=pass; d=google.com; s=arc-20160816; b=fOiSmVf0n0PgKszWNTDwL7vXc6zi0J5SRS3MY/QA4BmKUQhp5CqTFOvfBl4RmsOsba YoGgNEZrkVnvkuNSpe6wXRlGLABdGXNTp4GPMjjB+htoqZ1NyVDAPq/1+J2mIMX2mZj0 yR22oxAv+4xne2ZDxLdq74fYGCjH9x5uCqUHXwHHY14eTwQL9aa6cQLG8eM5mgilZw0C hy0nb+Uyba2bRP84O2e053Zc7bqXzHWCiI0O4yBq4I6zRqOhkKprmnBLCrInEhPUy2k3 1jJF9avyoBCtKbNv4y5y8Sa422z5GMgcXFEVCXE5tWkoGfYANfkgx4j37n/TvN7FLgQD G/2A== 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=Sp0vdxnnLzNBepfsm1Py9JTigDCfEeGg+5fNGBkPPHQ=; fh=7NZiSAZrRYszuatpSaNV39b2cM2fzEN2iHI8EfXs2Vg=; b=tTCToyqbJdreuqLwacpJB9cp+IZ2YfbYKjwOCfoA35eFZsIGAi8w/MHV+sdgrSo8tM b87XQNnS+SFPFSECb9eaFsIed+jfVpjbYyCPuDmxsm/MpDLv3h+uj7l6DR0ABcO1g7KG N6GuF+du225ar45nuErIeezQ2KdphAVPB1IMvVTWUBB4GgjWs1D3pnZdYxExJ0YuW+4I 34wuKMARjtRP7VaZM6QNQlGo1Sa7WTlXKVCLvURcfJp1gjQtXRpbGI0w99Ci05MhzU0p txDQEgCEi8CQBZh+eYGl92bflsmY8m0Ar7+DMxzMvZr2dfZKOkuHzVhaS4SCut+kBJ7G seCg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ezeLi77R; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1664-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1664-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f18-20020a05620a12f200b00783f6341992si9086352qkl.288.2024.01.31.15.14.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 15:14:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-1664-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ezeLi77R; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1664-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1664-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 733D31C258C3 for ; Wed, 31 Jan 2024 23:14:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E0841419A3; Wed, 31 Jan 2024 23:04:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ezeLi77R" X-Original-To: linux-nfs@vger.kernel.org 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 14B7D3CF68; Wed, 31 Jan 2024 23:04:03 +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=1706742244; cv=none; b=icL2UjKuVHTyZdoH4i4X19EtPm5OOMGKTQYxSmYZ7Z6wvH70HoE9zi2T/Gkv1SI5j2vEGAQmgNsndfn7N0tDOIa8kbEHKJB4olcwJaOn3F3gA+mmDaS8liQcK5w6nYk4nJ4KF3DYIcfx0HIjEEJ/ziYMtZX1SuqNc1aFRoZGQN8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706742244; c=relaxed/simple; bh=Z1i7xtMOMqvm3D7J9G0rdH3DGYJGfjyVOTowr14DW4I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mv3xfWrUG3qQ3/w5eWFndQGq19d4rfQASfvdWxznf9D+5A29kDYdDlBrbTbgfMnaRONhEiXoaqhrgaWnnuBHpXwtd5yAT7HJTsi5XUM6h/eo/KqvK1uuF8LYEvLQE0NJx9rr/ENM0dzME44LpLxbEE8SC+rsU94MB6LL8b0mh9w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ezeLi77R; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D382BC433B2; Wed, 31 Jan 2024 23:03:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706742243; bh=Z1i7xtMOMqvm3D7J9G0rdH3DGYJGfjyVOTowr14DW4I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ezeLi77RDC+M1M2PGVDqofoaYkKFWZx0BAyYGOzKAPHsqWMUe7xLTjpnu4PvioChG iGZwkecDAT27heYOpKXXAviTfBzS4j6lnoeIsfm7aGa0M9Z4/lxvn5EFHVXxkeZP9r HXzPDmLetN26GcPJdEMKXjpchS1MFHFkSPArD7BO8II60E4uZuEjBQ8OvvhUMTbS8N 3+0Sxt9Ki9uL/pzVkLoXmGQI54jn8i21BPWDWwFqopO6411gryQWyNj9YwX1TQxOvp s4+XzPVoKlACpUfflzE+NJ6PKIXrNbkI5vIYslelVhIFhO3Kr7UWr2nNkxIpUvO+GB krms0StfW8P5w== From: Jeff Layton Date: Wed, 31 Jan 2024 18:02:08 -0500 Subject: [PATCH v3 27/47] filelock: clean up locks_delete_block internals Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240131-flsplit-v3-27-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=1848; i=jlayton@kernel.org; h=from:subject:message-id; bh=Z1i7xtMOMqvm3D7J9G0rdH3DGYJGfjyVOTowr14DW4I=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlutFxdSj2FyNqB+Gw8Plq5ShJdeZ8Mw/eSh1Ig 3sO5sTmrJ2JAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZbrRcQAKCRAADmhBGVaC FVtCEADGeoEvKshm2+1gQy+z0fWDa7I+c8HaoX9GoO9xbTseu7MbPgfZlZSMSNROy+j4TEVc2GS A6Ny3poezAmDA4f1y50X2cVUWak3D1HwslyoVfmHOEcJsuWCp6KuAAmpGCWJCypye53gKSKDrbM hOB1GY6em/gj8ASt5oAWjinaXWgmfzFNONOdJVzam2X2kR6L3t//gw3pEhRXYEHdliEJKFfTUcR DSskL8b/KsgPjE8jpp2davDT+m2Va9WDqVIzm368X5n3JE5QjswtGSrEdR2OFE1Se740x+/8yrS ioHiB5xlKlYuIa5Oda3puIiTwJuE8yqefwNsBE4vAWdKHbzF4yGTtKtNC1lH6H4LtcP84PoMuKg d2v5VWVVHY1yInW1jkSLZcVAoQ8y4w0HX5ITn/RoQAf1UKzX9cMby6h5cuI4HrEZGgkY9Wnrp6h zTR38CBYsTL3R7+HWwJks/tWESERQaI08fBiAZvh8o3R5kajGS4/uSvqM07WbYtMyS2BYvlyEgl hTc1to+r2E8UrpyHOkLpSwVfLiWDOGJCX0w8xeVWvRLs0ng3IvbcQfHIV9RdNeXAvVl0Cc8+jbO DE63d718vTniChHhHYvl8NRy9hGyCbL4mRHpeMzNj7qE8uYnbMIkQotCQ4pQWDUJ9TXUpAZjQFd CtKW7Z7FK3oaDOA== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 Rework the internals of locks_delete_block to use struct file_lock_core (mostly just for clarity's sake). The prototype is not changed. Signed-off-by: Jeff Layton --- fs/locks.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/fs/locks.c b/fs/locks.c index 0aa1c94671cd..a2be1e0b5a94 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -697,9 +697,10 @@ static void __locks_wake_up_blocks(struct file_lock_core *blocker) * * lockd/nfsd need to disconnect the lock while working on it. */ -int locks_delete_block(struct file_lock *waiter) +int locks_delete_block(struct file_lock *waiter_fl) { int status = -ENOENT; + struct file_lock_core *waiter = &waiter_fl->c; /* * If fl_blocker is NULL, it won't be set again as this thread "owns" @@ -722,21 +723,21 @@ int locks_delete_block(struct file_lock *waiter) * no new locks can be inserted into its fl_blocked_requests list, and * can avoid doing anything further if the list is empty. */ - if (!smp_load_acquire(&waiter->c.flc_blocker) && - list_empty(&waiter->c.flc_blocked_requests)) + if (!smp_load_acquire(&waiter->flc_blocker) && + list_empty(&waiter->flc_blocked_requests)) return status; spin_lock(&blocked_lock_lock); - if (waiter->c.flc_blocker) + if (waiter->flc_blocker) status = 0; - __locks_wake_up_blocks(&waiter->c); - __locks_delete_block(&waiter->c); + __locks_wake_up_blocks(waiter); + __locks_delete_block(waiter); /* * The setting of fl_blocker to NULL marks the "done" point in deleting * a block. Paired with acquire at the top of this function. */ - smp_store_release(&waiter->c.flc_blocker, NULL); + smp_store_release(&waiter->flc_blocker, NULL); spin_unlock(&blocked_lock_lock); return status; } -- 2.43.0