From patchwork Wed Jan 31 23:02:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 195039 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:106:209c:c626 with SMTP id mn5csp85883dyc; Wed, 31 Jan 2024 15:20:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHCUoQypqZMJGGN+FX4sW1WDZnZDqTIQRkoKx1qkd2THnLMYtFFEayU4A999/CLhH9JqEd0 X-Received: by 2002:a05:620a:1350:b0:784:71a6:f8ce with SMTP id c16-20020a05620a135000b0078471a6f8cemr1028187qkl.44.1706743202406; Wed, 31 Jan 2024 15:20:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706743202; cv=pass; d=google.com; s=arc-20160816; b=KlCqJ7sk0uGtkj7hh33U3uXptw38JYNA5xfVB5IdpZjOVoQH/QIGrvBQPbH4YXDvln R6muhm9AYkcVCUc/+So0A6MEIRIj2MwlPzRZecGrS0qeQyFNth2U/qoNGAbtbIDwSpVL U6nAvdf0xIowsRtRnkco82dWYK5z78mVbvhvGXVrbEbcvpi7sIpqmQMJCpNV1dgjbmFU xdTcWT/CUN6Z4UeM0Aqki93ExTKG7NzVds4Zx+CtSO2koVRPYj+S7pi581CxbGJ+WPbE WiCaXvT9+JjH0Y1mnoSfYkePliBtCtedYfUAO5ii0mTlz+2iw8o5zzKhzB6s3v0h8ggn PN/A== 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=zc2nq62ZdWFG23GxLD00EW8dz3gxgvgnZetPn/ZRPXg=; fh=L1k69rXmmLf05+RDiMryX4sUfeTKZMKyyqTcyvTRPvI=; b=PlJlShpJawHamrdmpW9uxY8CNEZKT3az6E1wUlPNMu7IaUXvaxtAS+72XnD86FcGr0 p+ADIbQVGqhBSjr8wYNfY0RF0EfAGD0eJxEihBiznSSAjI8U8mwZc6kmUULwejpctZ1e z/bvw79zG9qV5+JTavNigZLmDg5gjZ5dVYFgnejYAbUbRj0IOlCks70uX7bfy+4VrwCw 8ymqy1bfG7cJ3rOAdUL0jinzpmzSGUiMqmyoX5wlEg+BdAgW+eaC9OI4ODvJKV+PGyv6 lW0t4jVC4aMajUt1GhOmyyRpp3dnF9OVFDH+LjszmZUK7wXYZwnY0lk+f7gCrRR0mYHZ /1mw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bc8E7uPZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47324-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47324-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCU+qMksHJAXd4wpySpZ4OABL/zPXEu3Y2dYkmcGp1G5nz0U5rSokGVzp0/FhmiqyUBPgq4RpqjcDlFWfA9mSZOfPCfYig== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g27-20020a05620a13db00b00783ff745819si7296970qkl.531.2024.01.31.15.20.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 15:20:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47324-ouuuleilei=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=bc8E7uPZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47324-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47324-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 272411C22650 for ; Wed, 31 Jan 2024 23:20:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3E6E148FEA; Wed, 31 Jan 2024 23:04:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bc8E7uPZ" 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 6A9521487F8; Wed, 31 Jan 2024 23:04:43 +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=1706742283; cv=none; b=scykox56b3WhydckRsECb34jGvKDAbKONTfdBe14XFeX6ojji9tC/Yin3Dh52nu2EXuKPflE0hQMb1utXauw+EtwVKSd+bAwX3P24V5ovJg9BNnvUr5dUrlmo8g7jsEGJu7JaPnyIb3mOs5QIXWIGKvwdL70jDO/5Kit36/7ruM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706742283; c=relaxed/simple; bh=P2mftGY8+3jqRTT4GbeHxI5uwsZT5isNJfmn++ZI1Bk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M/nGPE5m8ra5/64tOlZ+zzFFzheX6M1b8YEpTQQputj1LNzrT7mXBk/1VZiO9L+AaveXUhQz6mHEQ7OJ0LIHWV+x/+QGrkiyj1BM4tMLR1iYKuNn3KS7ccqBJ7bIYOlCK5i4Kb9lcxWeoVxgX7Vqmgge7m3ND8iNy6jlLlRX9D8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bc8E7uPZ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 805DFC433B2; Wed, 31 Jan 2024 23:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706742283; bh=P2mftGY8+3jqRTT4GbeHxI5uwsZT5isNJfmn++ZI1Bk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=bc8E7uPZzEjIqMcmVpMTC2B0blbxKheGwD1g/0gaWMLjljSPqD5kslOS7LlaVmDVi trkAlBztwvp+27E6+qTTj15LlWGwS0fK8LJ7zVLtc5hkTj273sdZ1iCq5mTuKSq4Im xH6yvPZ1CqeQpfaxZvkW9fV5l/dzy17034f5OkrbvLc97MYzuBzmrxaZRmveqys/1m hh8T+VIKGZkTYkczPuJ93lmeY1lm2JZDS+wZA02eVOviro3olJ8XEEWHjGPSOOmcwo sfd33z/gA8yv8J/IAn6H7Lm3LTid8RmWAMovr+8ZnOz+LkayPAf+tdwAYgvmU8QnAE jJP+pLtGW+R8w== From: Jeff Layton Date: Wed, 31 Jan 2024 18:02:18 -0500 Subject: [PATCH v3 37/47] dlm: adapt to breakup of struct file_lock 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-37-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=5038; i=jlayton@kernel.org; h=from:subject:message-id; bh=P2mftGY8+3jqRTT4GbeHxI5uwsZT5isNJfmn++ZI1Bk=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlutFzb1zHWnDUvdn7dUCqkyMWmb0Imqnfb554q Ee53RbtrMuJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZbrRcwAKCRAADmhBGVaC FSHID/4tsdwz2xYdPgYBK79/g0K0lrGcQCKjypuyTtD5w+IGCgOP08M3e4uBlRz/trqt7XLu12+ pPnwjVurb7JDU/HZZbLIiHYcxlZLUmPXr5QEEX+0Xs9aGqwpagTLCBIFIm1Vly5qrfyFuzfXUZ8 MhV1n9+CnAl9kS02N7S2QumuCmfYQ2XZ2oR8H/RIw3PFa5uLphyrfoOOPJ7TKl1u9JAxQwyyq0z V+Iq19y/azY+DrWrOVqDZ/IJvdrOqs+3wzZkOfndW+MD3Z+PQpsiFGfqCvuZSGh+/nlnltY1PIc 12EF6bPV2Qf6Db4sCLzsVYPzJ/UHlPWAVJhhJTcfc7P8H2FJsKqEL5iESCdAnmThLcP/mCX5Y66 vV0tbZ50rbHb51Tln1s1HMPximLcivGRFupLMQCiAXkGWXT0IRsaMke8fLviSC+MrYDm3z9+z/L CtxmIS5u5WuS9pYz54Ury8bsZSOP3QBoN8tNbFIAPDOA14Tt15ijmj2R8QE3gazUvH4/ZwIWgK8 mNuCb7JQ9VjqpvBfffh6aYLEiEW3pZ0K+OyOIJsLC/EIm65s3N+LU52j/Gvqe1mba2Px55xSZGw qGilOoQ2C5oB+HNc2QhvNSvdlPvxt8E6/fNxVa/jO/Yd6QS4Vsv2Rba2FxVxXHRWDA8+lEHCTSl 78Y4uaEWldNrAEA== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789649960397882807 X-GMAIL-MSGID: 1789649960397882807 Most of the existing APIs have remained the same, but subsystems that access file_lock fields directly need to reach into struct file_lock_core now. Signed-off-by: Jeff Layton --- fs/dlm/plock.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c index fdcddbb96d40..9ca83ef70ed1 100644 --- a/fs/dlm/plock.c +++ b/fs/dlm/plock.c @@ -4,7 +4,6 @@ */ #include -#define _NEED_FILE_LOCK_FIELD_MACROS #include #include #include @@ -139,14 +138,14 @@ 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 = (lock_is_write(fl)); - op->info.wait = !!(fl->fl_flags & FL_SLEEP); + op->info.pid = fl->c.flc_pid; + op->info.ex = lock_is_write(fl); + op->info.wait = !!(fl->c.flc_flags & FL_SLEEP); op->info.fsid = ls->ls_global_id; op->info.number = number; op->info.start = fl->fl_start; op->info.end = fl->fl_end; - op->info.owner = (__u64)(long)fl->fl_owner; + op->info.owner = (__u64)(long) fl->c.flc_owner; /* async handling */ if (fl->fl_lmops && fl->fl_lmops->lm_grant) { op_data = kzalloc(sizeof(*op_data), GFP_NOFS); @@ -259,7 +258,7 @@ static int dlm_plock_callback(struct plock_op *op) } /* got fs lock; bookkeep locally as well: */ - flc->fl_flags &= ~FL_SLEEP; + flc->c.flc_flags &= ~FL_SLEEP; if (posix_lock_file(file, flc, NULL)) { /* * This can only happen in the case of kmalloc() failure. @@ -292,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 saved_flags = fl->fl_flags; + unsigned char saved_flags = fl->c.flc_flags; ls = dlm_find_lockspace_local(lockspace); if (!ls) @@ -305,7 +304,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file, } /* cause the vfs unlock to return ENOENT if lock is not found */ - fl->fl_flags |= FL_EXISTS; + fl->c.flc_flags |= FL_EXISTS; rv = locks_lock_file_wait(file, fl); if (rv == -ENOENT) { @@ -318,14 +317,14 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file, } op->info.optype = DLM_PLOCK_OP_UNLOCK; - op->info.pid = fl->fl_pid; + op->info.pid = fl->c.flc_pid; op->info.fsid = ls->ls_global_id; op->info.number = number; op->info.start = fl->fl_start; op->info.end = fl->fl_end; - op->info.owner = (__u64)(long)fl->fl_owner; + op->info.owner = (__u64)(long) fl->c.flc_owner; - if (fl->fl_flags & FL_CLOSE) { + if (fl->c.flc_flags & FL_CLOSE) { op->info.flags |= DLM_PLOCK_FL_CLOSE; send_op(op); rv = 0; @@ -346,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 = saved_flags; + fl->c.flc_flags = saved_flags; return rv; } EXPORT_SYMBOL_GPL(dlm_posix_unlock); @@ -376,14 +375,14 @@ int dlm_posix_cancel(dlm_lockspace_t *lockspace, u64 number, struct file *file, return -EINVAL; memset(&info, 0, sizeof(info)); - info.pid = fl->fl_pid; - info.ex = (lock_is_write(fl)); + info.pid = fl->c.flc_pid; + info.ex = lock_is_write(fl); info.fsid = ls->ls_global_id; dlm_put_lockspace(ls); info.number = number; info.start = fl->fl_start; info.end = fl->fl_end; - info.owner = (__u64)(long)fl->fl_owner; + info.owner = (__u64)(long) fl->c.flc_owner; rv = do_lock_cancel(&info); switch (rv) { @@ -438,13 +437,13 @@ 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 = (lock_is_write(fl)); + op->info.pid = fl->c.flc_pid; + op->info.ex = lock_is_write(fl); op->info.fsid = ls->ls_global_id; op->info.number = number; op->info.start = fl->fl_start; op->info.end = fl->fl_end; - op->info.owner = (__u64)(long)fl->fl_owner; + op->info.owner = (__u64)(long) fl->c.flc_owner; send_op(op); wait_event(recv_wq, (op->done != 0)); @@ -456,16 +455,16 @@ int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file, rv = op->info.rv; - fl->fl_type = F_UNLCK; + fl->c.flc_type = F_UNLCK; if (rv == -ENOENT) rv = 0; else if (rv > 0) { locks_init_lock(fl); - fl->fl_type = (op->info.ex) ? F_WRLCK : F_RDLCK; - fl->fl_flags = FL_POSIX; - fl->fl_pid = op->info.pid; + fl->c.flc_type = (op->info.ex) ? F_WRLCK : F_RDLCK; + fl->c.flc_flags = FL_POSIX; + fl->c.flc_pid = op->info.pid; if (op->info.nodeid != dlm_our_nodeid()) - fl->fl_pid = -fl->fl_pid; + fl->c.flc_pid = -fl->c.flc_pid; fl->fl_start = op->info.start; fl->fl_end = op->info.end; rv = 0;