[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240116-flsplit-v1-19-c9d0f4370a5d@kernel.org>
Date: Tue, 16 Jan 2024 14:46:15 -0500
From: Jeff Layton <jlayton@...nel.org>
To: Christian Brauner <brauner@...nel.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Eric Van Hensbergen <ericvh@...nel.org>,
Latchesar Ionkov <lucho@...kov.net>,
Dominique Martinet <asmadeus@...ewreck.org>,
Christian Schoenebeck <linux_oss@...debyte.com>,
David Howells <dhowells@...hat.com>, Marc Dionne <marc.dionne@...istor.com>,
Xiubo Li <xiubli@...hat.com>, Ilya Dryomov <idryomov@...il.com>,
Alexander Aring <aahringo@...hat.com>, David Teigland <teigland@...hat.com>,
Miklos Szeredi <miklos@...redi.hu>,
Andreas Gruenbacher <agruenba@...hat.com>,
Trond Myklebust <trond.myklebust@...merspace.com>,
Anna Schumaker <anna@...nel.org>, Chuck Lever <chuck.lever@...cle.com>,
Neil Brown <neilb@...e.de>, Olga Kornievskaia <kolga@...app.com>,
Dai Ngo <Dai.Ngo@...cle.com>, Tom Talpey <tom@...pey.com>,
Jan Kara <jack@...e.cz>, Mark Fasheh <mark@...heh.com>,
Joel Becker <jlbec@...lplan.org>, Joseph Qi <joseph.qi@...ux.alibaba.com>,
Steve French <sfrench@...ba.org>, Paulo Alcantara <pc@...guebit.com>,
Ronnie Sahlberg <lsahlber@...hat.com>,
Shyam Prasad N <sprasad@...rosoft.com>, Namjae Jeon <linkinjeon@...nel.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: linux-kernel@...r.kernel.org, v9fs@...ts.linux.dev,
linux-afs@...ts.infradead.org, ceph-devel@...r.kernel.org,
gfs2@...ts.linux.dev, linux-fsdevel@...r.kernel.org,
linux-nfs@...r.kernel.org, ocfs2-devel@...ts.linux.dev,
linux-cifs@...r.kernel.org, samba-technical@...ts.samba.org,
linux-trace-kernel@...r.kernel.org, Jeff Layton <jlayton@...nel.org>
Subject: [PATCH 19/20] filelock: convert locks_insert_lock_ctx and
locks_delete_lock_ctx
Have these functions take a file_lock_core pointer instead of a
file_lock.
Signed-off-by: Jeff Layton <jlayton@...nel.org>
---
fs/locks.c | 44 ++++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/fs/locks.c b/fs/locks.c
index 88c72eb4672e..6d24cf2525ec 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -847,28 +847,28 @@ static void locks_wake_up_blocks(struct file_lock_core *blocker)
}
static void
-locks_insert_lock_ctx(struct file_lock *fl, struct list_head *before)
+locks_insert_lock_ctx(struct file_lock_core *fl, struct list_head *before)
{
- list_add_tail(&fl->fl_core.fl_list, before);
- locks_insert_global_locks(&fl->fl_core);
+ list_add_tail(&fl->fl_list, before);
+ locks_insert_global_locks(fl);
}
static void
-locks_unlink_lock_ctx(struct file_lock *fl)
+locks_unlink_lock_ctx(struct file_lock_core *fl)
{
- locks_delete_global_locks(&fl->fl_core);
- list_del_init(&fl->fl_core.fl_list);
- locks_wake_up_blocks(&fl->fl_core);
+ locks_delete_global_locks(fl);
+ list_del_init(&fl->fl_list);
+ locks_wake_up_blocks(fl);
}
static void
-locks_delete_lock_ctx(struct file_lock *fl, struct list_head *dispose)
+locks_delete_lock_ctx(struct file_lock_core *fl, struct list_head *dispose)
{
locks_unlink_lock_ctx(fl);
if (dispose)
- list_add(&fl->fl_core.fl_list, dispose);
+ list_add(&fl->fl_list, dispose);
else
- locks_free_lock(fl);
+ locks_free_lock(file_lock(fl));
}
/* Determine if lock sys_fl blocks lock caller_fl. Common functionality
@@ -1095,7 +1095,7 @@ static int flock_lock_inode(struct inode *inode, struct file_lock *request)
if (request->fl_core.fl_type == fl->fl_core.fl_type)
goto out;
found = true;
- locks_delete_lock_ctx(fl, &dispose);
+ locks_delete_lock_ctx(&fl->fl_core, &dispose);
break;
}
@@ -1120,7 +1120,7 @@ static int flock_lock_inode(struct inode *inode, struct file_lock *request)
goto out;
locks_copy_lock(new_fl, request);
locks_move_blocks(new_fl, request);
- locks_insert_lock_ctx(new_fl, &ctx->flc_flock);
+ locks_insert_lock_ctx(&new_fl->fl_core, &ctx->flc_flock);
new_fl = NULL;
error = 0;
@@ -1259,7 +1259,7 @@ static int posix_lock_inode(struct inode *inode, struct file_lock *request,
else
request->fl_end = fl->fl_end;
if (added) {
- locks_delete_lock_ctx(fl, &dispose);
+ locks_delete_lock_ctx(&fl->fl_core, &dispose);
continue;
}
request = fl;
@@ -1288,7 +1288,7 @@ static int posix_lock_inode(struct inode *inode, struct file_lock *request,
* one (This may happen several times).
*/
if (added) {
- locks_delete_lock_ctx(fl, &dispose);
+ locks_delete_lock_ctx(&fl->fl_core, &dispose);
continue;
}
/*
@@ -1305,9 +1305,9 @@ static int posix_lock_inode(struct inode *inode, struct file_lock *request,
locks_move_blocks(new_fl, request);
request = new_fl;
new_fl = NULL;
- locks_insert_lock_ctx(request,
+ locks_insert_lock_ctx(&request->fl_core,
&fl->fl_core.fl_list);
- locks_delete_lock_ctx(fl, &dispose);
+ locks_delete_lock_ctx(&fl->fl_core, &dispose);
added = true;
}
}
@@ -1336,7 +1336,7 @@ static int posix_lock_inode(struct inode *inode, struct file_lock *request,
}
locks_copy_lock(new_fl, request);
locks_move_blocks(new_fl, request);
- locks_insert_lock_ctx(new_fl, &fl->fl_core.fl_list);
+ locks_insert_lock_ctx(&new_fl->fl_core, &fl->fl_core.fl_list);
fl = new_fl;
new_fl = NULL;
}
@@ -1348,7 +1348,7 @@ static int posix_lock_inode(struct inode *inode, struct file_lock *request,
left = new_fl2;
new_fl2 = NULL;
locks_copy_lock(left, right);
- locks_insert_lock_ctx(left, &fl->fl_core.fl_list);
+ locks_insert_lock_ctx(&left->fl_core, &fl->fl_core.fl_list);
}
right->fl_start = request->fl_end + 1;
locks_wake_up_blocks(&right->fl_core);
@@ -1448,7 +1448,7 @@ int lease_modify(struct file_lock *fl, int arg, struct list_head *dispose)
printk(KERN_ERR "locks_delete_lock: fasync == %p\n", fl->fl_fasync);
fl->fl_fasync = NULL;
}
- locks_delete_lock_ctx(fl, dispose);
+ locks_delete_lock_ctx(&fl->fl_core, dispose);
}
return 0;
}
@@ -1581,7 +1581,7 @@ int __break_lease(struct inode *inode, unsigned int mode, unsigned int type)
fl->fl_downgrade_time = break_time;
}
if (fl->fl_lmops->lm_break(fl))
- locks_delete_lock_ctx(fl, &dispose);
+ locks_delete_lock_ctx(&fl->fl_core, &dispose);
}
if (list_empty(&ctx->flc_lease))
@@ -1839,7 +1839,7 @@ generic_add_lease(struct file *filp, int arg, struct file_lock **flp, void **pri
if (!leases_enable)
goto out;
- locks_insert_lock_ctx(lease, &ctx->flc_lease);
+ locks_insert_lock_ctx(&lease->fl_core, &ctx->flc_lease);
/*
* The check in break_lease() is lockless. It's possible for another
* open to race in after we did the earlier check for a conflicting
@@ -1852,7 +1852,7 @@ generic_add_lease(struct file *filp, int arg, struct file_lock **flp, void **pri
smp_mb();
error = check_conflicting_open(filp, arg, lease->fl_core.fl_flags);
if (error) {
- locks_unlink_lock_ctx(lease);
+ locks_unlink_lock_ctx(&lease->fl_core);
goto out;
}
--
2.43.0
Powered by blists - more mailing lists