From patchwork Wed Jan 31 23:02:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 195032 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:106:209c:c626 with SMTP id mn5csp84149dyc; Wed, 31 Jan 2024 15:16:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHY8wxWHkIOXbeNz5jnhPZWp3M0/I8FljQ+ei4s+0t4a0ml5XUg9UNuqwzalAHkVffoNaxU X-Received: by 2002:a05:620a:2988:b0:783:bf05:9f42 with SMTP id r8-20020a05620a298800b00783bf059f42mr791081qkp.58.1706742970913; Wed, 31 Jan 2024 15:16:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706742970; cv=pass; d=google.com; s=arc-20160816; b=Ib9GcCaKhGOoPYKmzE10uwagKmG67ft4GaJQn/kynpa5P5hYMR4KXx/1C2AzqA3JhI U8MJKtQ0yEkJ4tw2iSB/ZSc1wmc+M+4V57A8IiOPTUcnhfrYNKpPLlbPYU/rPbml9IHy l06YAVaCHkq+wCyORj2/bI06ZdfUK9u1HVv4Vz+1WOWmutlMqChmaMX8Ns7lzJRTX32Y mH282Md2zYNe6lBP8epWLqjTPkwokV5YbrRsoIsY3fGpnNBlwYyC8gCtvp4sHlTMORsc dFyuA181CXT5PfHbEObc4N7wrZxP6R1AaUd/EohsaoVWhpU0eo8H2RC9KmkCNKp5DC2H a2NA== 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=SjELkwGGs9HrjE5f7VFQ3AI0zilSzGutEtke0NHPRXo=; b=gji+y8BAyKSPmjN7DLcaBUUG/VRjyr+EpuWG6WtsLCtMLaLf1/tjxWySz4jR830QoK VOycMSZ68aab3cN/mBoXa1vtVWk4/WsYtUeUVvreESZZ57JxD/r4P5L/kQ3yqwmXhlCl fHub/lmtZ35Bu+ykunpnFOKgtBFipsQHfiSrTXIkykYVdY+yNSVUej+gdf8PkSr5l0AO 1AipDTifiXIVtiO63qzUdSY6b7u8ICvCYPU4OcfQYrhb8EkOtCyqAaX9/pecTRnaXOXs Wh827glRCN9L6NZOKzo449aphtRIpMU5vTL+P91c8QNnTEVE++us62IXnRkf+58GVHUl qMkQ==; dara=google.com 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-kernel+bounces-47314-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47314-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCWozqOZ0qPWgMhRTEQtQqQ4PT/TKdqAyWnzJsGi/4F+G+NkG0VP/XZ49vza9dAP3/v5N/VokOimKFacXilDTuS9+HFuMA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id b7-20020a05620a04e700b00783f7be929esi8486690qkh.96.2024.01.31.15.16.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 15:16:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47314-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; 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-kernel+bounces-47314-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47314-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id DF2A61C22836 for ; Wed, 31 Jan 2024 23:15:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0DD9D1420A7; Wed, 31 Jan 2024 23:04:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ezeLi77R" 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789649717872380908 X-GMAIL-MSGID: 1789649717872380908 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; }