Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1675588rdb; Thu, 25 Jan 2024 02:56:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHegBXEopZZiWEFIoEZYjQ52+cYiilz1d800CoAEueMkhPqVffn6AvTF3Ze3Sqf3RosICSp X-Received: by 2002:a05:6808:1811:b0:3bd:bba6:9b14 with SMTP id bh17-20020a056808181100b003bdbba69b14mr819776oib.27.1706180172595; Thu, 25 Jan 2024 02:56:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706180172; cv=pass; d=google.com; s=arc-20160816; b=aDZas/JOtGhyS4LgGOcrBJXSKn1qkZTPoT/Sg8UzxDEhuKTK+SD5leyo8WxzOU6Y+M oUwqhZzC6qy6RHWnN7hVMFCaWVg56mAjtvGvTnuTrAtTHbg0UWll5Hg9abmv4zJH12nd ytR/O6/5KCBZw95GEr342w9wBbVkFiXyXQhhacawP6a03EQBwoKPkdJz8LPNGwI2sGLP esYYnlmpYoKKgM96UlIjLih1bxqW5yENhgwio8p+KDEFP3OCIyUVHs3xpIxRo3G5tXDA TJDAifSlk88G8ih22jcm1AEYjL3BsxfBfD7JBgMM3ayrhltTLBUCqQZy3hTg1RpuboWM 016A== 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=YvUsxcNJnteD/QPZdt3ctNhAi+6TpknD5gKogLLTjpM=; fh=AED2lrIQZhdppGHbaRrNz6/BI48B+mbutB2egpFPmJc=; b=wUaRIQg3F3/xWMy+m03y8ceGMQCdY0fZU8wfMrtn61avKp4hocNm5D4/e4SOjNSGXX 5F42Sna6tGLhEM2kt2HVUFXApoBGhIxwdzUDuPNQQz18AoDO2YH7hxldRYDAEOowugQa mcBapa07/bObE+0Lx5gMqa9GfcvXL12VPcqFKnfjWwbOlZ7rSLNepF1dW81xc7ZOTNtR OMlWoqX+qjC6BUU4KDLyszpTYBXm95CF9On2TIT0Cmn7IC68xHztultHD0y+M7EhDfpp feSA/kZ3YUFFz+SQ3SCXVesVmA4QCIpOCYsvG3evzTtgXsK8UGTwaK8LHhJvy05vspG7 ExDA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e90pN0CC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1355-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1355-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a16-20020a62d410000000b006d99fca81d2si15399640pfh.382.2024.01.25.02.56.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 02:56:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-1355-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e90pN0CC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1355-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1355-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 38ADC281B9D for ; Thu, 25 Jan 2024 10:56:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BEE253309C; Thu, 25 Jan 2024 10:44:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="e90pN0CC" 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 8809060EE4; Thu, 25 Jan 2024 10:44:39 +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=1706179479; cv=none; b=Q+4cFnU15Ueo5Q8hFrdk0XB8JtYjI69Chr6ldFicnMn/dPv0hYOER/a4v98MOZw5LCK5VhqalVsx0nyNot13eTtN0/e6lbDVDXzRKAn7SXtzHrh9cJgiLeDQKbHQG83w17SIDI1MRATOJubeLK+SuSies9C2QTHrNySyfLsyAI4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706179479; c=relaxed/simple; bh=qjAY+Yc9t3KdmxLT7uCiNgjt2jj+CbSOO+1wisiSIS4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ppGHXJH7u6Hw+fRk+a1u4/Ty3qnATRwl3cKONLnZcU3VEWDc1uaAafBCgdx+jFPRu24cWIwJLTZ0TPq4uEw1eAz4M7rRsXI+lVVY/JfMxLborCrgGjrRivT3pqH8rNlG6eex3yxsX1f1d6iEe3F2zE6yYS28v5Qwz6WPoo0fX10= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=e90pN0CC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0FF3C43390; Thu, 25 Jan 2024 10:44:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706179479; bh=qjAY+Yc9t3KdmxLT7uCiNgjt2jj+CbSOO+1wisiSIS4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=e90pN0CC4IliJTH8hSXxNKTr1haQzkPddgP/rDUr3TCsEP0H27psQ8vSGvx2ikmlK Eh8RdKHSBDxezQvvV8BGXbCvmllginf05KyS2KexZQfKOYgMyhhtgx/Hyd+qa5Sq05 P+8mB+deuYCrNN/d5z4sNwMiL8ZHBRfNDwMsKIOh/1H/kqpX8TM7iVHdwRNIlD+OgG 5k6afRT/Ib7kGmqYp3I+GFtRDuIHF9xCCmfNbORnKN49rlKTUdY7gWn/6exrHUyohg 8DubepdX+BBl/Ff48gGsedki11MuERvUmD6FWL6YuumXl6/p930RpFwnjxbbefgeKd PUPb1v87kumUA== From: Jeff Layton Date: Thu, 25 Jan 2024 05:43:03 -0500 Subject: [PATCH v2 22/41] 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: <20240125-flsplit-v2-22-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=1890; i=jlayton@kernel.org; h=from:subject:message-id; bh=qjAY+Yc9t3KdmxLT7uCiNgjt2jj+CbSOO+1wisiSIS4=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlsjs8FH6gMpwQdYKuh8876nJJ1THPHZ05tbz5o tfLDTtS/CmJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZbI7PAAKCRAADmhBGVaC FVrsEACf8eiJu8e08kxG39lXtQ9EakrO9CgjzZ9eYSy4JDzN2Qgd2oqyErKMqn7W7a38VZg9uMA g1TS6iwH5qK0My8cBGUcA1plbeytu66VkqeIA/axkQZrldkHeNTUwQuFac6vIByH9Wwo7mTf4hu wRsJTXtoyj6YU8IUjpoma6qXn0ehGIn4Km6HLTCFeHEp1bkjk+iFPDTSHwKS6MjlgQMc9K/ldKa nRCGieXTsyaxCcpX1ZkVHvXNJiPU/+2A+8pLWjd3LkUBIdiYhoij01/TIHaKW0dZpjmFj013iPA BAfl2DjfBV4QzhmNWdXOkLa1XY2A9NQc1YzSVKsR5UGBgCXsF+N/ZJjkaAdQ9Qirnt6mIYTq8W0 ktNWdJy4/ITz4FbW65C1mUWXmg/eXjJcbDa4+BQ0/XbL/Yc1yMQyMyKnfgCDu/jj2CjFP8k2hti pdZl6eadMjXkw/SiNz+Ro2t/TRVRLVk1B/x7a2W5e7VWt0n3WkLd/nPXSOeqbkKPVOCLLbDJY3b t12MPh34CeLy0eF+WpBXoFhK9/1HBhrh/xbLWDEaeCDnIwu7bI48GQTS/9WY//18HYIl91xGzIe ufyQCWpH3gfKQIb8fLQD7LTASISerAOFOEAgWkiyrO0eTN+e0kYm2UYP2/l7WHDw78KJ/FmHJ9S +Vq3/Fh7XpN0LRg== 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 8e320c95c416..739af36d98df 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->fl_core; /* * 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->fl_core.flc_blocker) && - list_empty(&waiter->fl_core.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->fl_core.flc_blocker) + if (waiter->flc_blocker) status = 0; - __locks_wake_up_blocks(&waiter->fl_core); - __locks_delete_block(&waiter->fl_core); + __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->fl_core.flc_blocker, NULL); + smp_store_release(&waiter->flc_blocker, NULL); spin_unlock(&blocked_lock_lock); return status; } -- 2.43.0