From patchwork Wed Jan 31 23:01:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 195018 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:106:209c:c626 with SMTP id mn5csp79632dyc; Wed, 31 Jan 2024 15:06:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IGJUfuzfMM6qDwt15rD+7pNAF4/ek+Th/ZX0mf0IuwWWJ4BxRPpXeaiu29h+FqZGdJvKfdK X-Received: by 2002:a05:622a:11cf:b0:42a:a88c:957e with SMTP id n15-20020a05622a11cf00b0042aa88c957emr3299614qtk.24.1706742397053; Wed, 31 Jan 2024 15:06:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706742397; cv=pass; d=google.com; s=arc-20160816; b=AXn2pzu5ADqI4HA2JA6X/0LT1s2tWTwm1unC0xM6aWis9dk0LkvPqJxU6DtiyY+WTy 71d51IA70/aaF/Y7Nu86VUtrK74B9tDd4CliALZX4XjLgAk/NkhSHQb1TmSpak8h4JYX RFHBLbAmNtXDoU1rCF99HOa9CS//835iS5t1oziEb4/aHAnCX0hkIf3lcUf1SrLOqn/a vc6veF390CqvxgFBdgR383PY1u6bPKYJoleWwxQtH/O4bweedIhQ3vr2nTerWxcatVN8 OhcFQuZneG3mPpnoZ3fWBhcWeLIwjODtbBClM/eV1SEJ2kzHPdEvYsg8ylNm1hhfKo75 shOA== 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=BQjk7slN7DC35No/z3JE3ukAe17EoF0jtIqcGSsI8Mc=; fh=G2T/MWADrdo3Sy7n7AFpOPmXxhpV+jwNIdC3vZh9MCk=; b=RLPFyTuu+3UwNPeJU7hDexrFQ0M2mTMrR48RlOkLV9QeULvkupzPpst8dYvYh+BvgK lKr+scEYVy55ZKb8ySdw7Sv6XN+kkuClbNQuhgTY+Rt3kKXky7v5d/t8UYHg2L/eJBEz IaWrCsuZDJHphh857DhZ3PZrQdRaXxGN/jQ0Pzo9Tc/a+wj43APgi9sMRuVEvdo6l3lX jR+DZ1efco8DeVSQ9iMv8nzqNNBL2H76a4R0olOn6SzM0BAqTmaEqB8RMMXKMcWM6idD Wv22Jb8XkZ3sS1N0KxZ7hS66fadhhF61X+LpUtsmkCrzx6j+yvCnbpAkKQLU2aRL8Qd2 6e7Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G6TSDctV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47294-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47294-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCUlhb6HpWHwDIlG0jm5gJNLlbI5qN7lkrUIcX4J2hrso9U6OVYGA8vyyvKBWaXrpbxKKRai9bJp10eZEVcHyiv9BVz+tg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c11-20020a05622a058b00b0042a7431a4b7si13270857qtb.240.2024.01.31.15.06.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 15:06:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47294-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=G6TSDctV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47294-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47294-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 D3C491C20DEC for ; Wed, 31 Jan 2024 23:06:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E6E246B9A; Wed, 31 Jan 2024 23:02:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="G6TSDctV" 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 8DCC045C07; Wed, 31 Jan 2024 23:02:48 +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=1706742168; cv=none; b=c7ABhYwidiRMvCbJPVcYwESIfgKa5pWd0aLxpttdiHZ6qG+p0mskIeTHcZXBqBAq4nQyz0K4UMB/CBp/YPAFDS5tM+08AYnYayxatCwqjdEbsTpBt3LPreJmYF6o22HG3Z64wgGs9EQRHakSBlf6qIxFJHH9BPbooZGWnzCKWms= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706742168; c=relaxed/simple; bh=nxRAveAqE7WF9Z4q90ZvBndTgcucgYKZ5gjGnB+BWHA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RsRqiKAhJUECPqV3T0GUgnt0P9ZmvzRaU0CgT3RL0EFEGhMCMGYsGfn3wXWvoJvEFcdi+RAt0/nCfZh16YmTaUnT8nQEjqJ2ZQeTKC/wAkOIbbo5lcpB+oCwNr7Ln5FYm+AgBz6ThS0Barm63uWVsJ+gS9F+RsC5OuOVUVs/l2k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=G6TSDctV; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60A94C43142; Wed, 31 Jan 2024 23:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706742168; bh=nxRAveAqE7WF9Z4q90ZvBndTgcucgYKZ5gjGnB+BWHA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=G6TSDctVx0EAoLL7MKJOe7dg6dAQ69yCO5HOY68otxwXguUX1qVr8+FCO6c1AuVL2 YmVsaz2EysbtySwd0vVbMAZfL1TaimjEO+x+lYGkf9FW3awXE6Np0AqIeDtDBMTnwH 28OwF4AAjGKTUen6L7BBl2nGT490B8FsVC4uPSXHGwwkkRnYMkQ7wv3lIZ6sqkdLW5 BQJzUJn+avSuNkZvjPWoMDTDdDwrHl0DlkIZWoU9xVpoTmoxReSb2D6b5SAtPIltdx /7GeZsExlO3Hh5biggJnt8dk7ZE4OJmttPsBB1PCbWmbq+1aLcKrXthPi2xvyUarL6 w2myiSNvtMEAw== From: Jeff Layton Date: Wed, 31 Jan 2024 18:01:49 -0500 Subject: [PATCH v3 08/47] dlm: convert to using new filelock helpers 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-8-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=2131; i=jlayton@kernel.org; h=from:subject:message-id; bh=nxRAveAqE7WF9Z4q90ZvBndTgcucgYKZ5gjGnB+BWHA=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlutFvbOKPbcg5w9YPlh79kzOLxpbHp7c7796Aw c+EXzMZANyJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZbrRbwAKCRAADmhBGVaC FSdnD/0YO3VvUkyTdJLamrF+VheQvuF2wqr3jNFP/fHAw88i6wMR20Q0W+/dSGKZdx3wZzjbaRK r1YnHtyc3ppCVPGqsU1Q+Sd2KH/6VQqfowXAY2jo7svL25xFhAxKQxStToPjow4skvr8GYOQw+3 QWilBdJr49gEAEeri2QaP6LNeB/CWAiugP8ypphJ10S1JXUXwhwVxJ4w2kctiQQDReU9DXySbOQ ljX3WCNIxoe6YH3kmFbMMIc/8IDUOVx/UhVnWQxFz1mTpk8uYj9OQp4rjZXrLC2U5AwUiY1WhzO 8yJ1NU8PEobtjVAGn4z8Qe2C54YM1UgTvwwGWABmjMnymHdoFvFj2c0yCIK8FVLsHu0VT9uj/+7 guHuAcJ6uuVa3dy4rv1ly8L+BaBSdzlPLjzbZXVnmNPP0fHR5DBA9Zh7NRDWNluSXo6IegFDFat rINPZng0LZHi7Da6fAV94Es/hDLo4SJ26hR0c6CWoJyhS3fCTmQ2EMsMCta88baiDfS3fdKlXoE jHvmLC8WJEy1LNcq/8O3FMUWO6vyhjWg7vRV5ovc+OFljB3ACFkXbKtioiVk6gspAA6TNa2rXOt coLckJ+ikvz1mc9ZnjkAvcIratWdBcP+gWRicgWQGMB/bksk5ZUnU74ll1F5lo/ZHAF89L8UcPG 2uY5MVD2xpeeVeQ== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789649115778127181 X-GMAIL-MSGID: 1789649115778127181 Convert to using the new file locking helper functions. Also, in later patches we're going to introduce some temporary macros with names that clash with the variable name in dlm_posix_unlock. Rename it. Signed-off-by: Jeff Layton --- fs/dlm/plock.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c index d814c5121367..42c596b900d4 100644 --- a/fs/dlm/plock.c +++ b/fs/dlm/plock.c @@ -139,7 +139,7 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file, op->info.optype = DLM_PLOCK_OP_LOCK; op->info.pid = fl->fl_pid; - op->info.ex = (fl->fl_type == F_WRLCK); + op->info.ex = (lock_is_write(fl)); op->info.wait = !!(fl->fl_flags & FL_SLEEP); op->info.fsid = ls->ls_global_id; op->info.number = number; @@ -291,7 +291,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file, struct dlm_ls *ls; struct plock_op *op; int rv; - unsigned char fl_flags = fl->fl_flags; + unsigned char saved_flags = fl->fl_flags; ls = dlm_find_lockspace_local(lockspace); if (!ls) @@ -345,7 +345,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file, dlm_release_plock_op(op); out: dlm_put_lockspace(ls); - fl->fl_flags = fl_flags; + fl->fl_flags = saved_flags; return rv; } EXPORT_SYMBOL_GPL(dlm_posix_unlock); @@ -376,7 +376,7 @@ int dlm_posix_cancel(dlm_lockspace_t *lockspace, u64 number, struct file *file, memset(&info, 0, sizeof(info)); info.pid = fl->fl_pid; - info.ex = (fl->fl_type == F_WRLCK); + info.ex = (lock_is_write(fl)); info.fsid = ls->ls_global_id; dlm_put_lockspace(ls); info.number = number; @@ -438,7 +438,7 @@ int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file, op->info.optype = DLM_PLOCK_OP_GET; op->info.pid = fl->fl_pid; - op->info.ex = (fl->fl_type == F_WRLCK); + op->info.ex = (lock_is_write(fl)); op->info.fsid = ls->ls_global_id; op->info.number = number; op->info.start = fl->fl_start;