Commit 4629172f authored by Jeff Layton's avatar Jeff Layton Committed by Christian Brauner

filelock: make locks_{insert,delete}_global_locks take file_lock_core arg

Convert these functions to take a file_lock_core instead of a file_lock.
Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/r/20240131-flsplit-v3-22-c6129007ee8d@kernel.orgReviewed-by: default avatarNeilBrown <neilb@suse.de>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent ad399740
...@@ -596,20 +596,20 @@ static int posix_same_owner(struct file_lock_core *fl1, struct file_lock_core *f ...@@ -596,20 +596,20 @@ static int posix_same_owner(struct file_lock_core *fl1, struct file_lock_core *f
} }
/* Must be called with the flc_lock held! */ /* Must be called with the flc_lock held! */
static void locks_insert_global_locks(struct file_lock *fl) static void locks_insert_global_locks(struct file_lock_core *flc)
{ {
struct file_lock_list_struct *fll = this_cpu_ptr(&file_lock_list); struct file_lock_list_struct *fll = this_cpu_ptr(&file_lock_list);
percpu_rwsem_assert_held(&file_rwsem); percpu_rwsem_assert_held(&file_rwsem);
spin_lock(&fll->lock); spin_lock(&fll->lock);
fl->c.flc_link_cpu = smp_processor_id(); flc->flc_link_cpu = smp_processor_id();
hlist_add_head(&fl->c.flc_link, &fll->hlist); hlist_add_head(&flc->flc_link, &fll->hlist);
spin_unlock(&fll->lock); spin_unlock(&fll->lock);
} }
/* Must be called with the flc_lock held! */ /* Must be called with the flc_lock held! */
static void locks_delete_global_locks(struct file_lock *fl) static void locks_delete_global_locks(struct file_lock_core *flc)
{ {
struct file_lock_list_struct *fll; struct file_lock_list_struct *fll;
...@@ -620,12 +620,12 @@ static void locks_delete_global_locks(struct file_lock *fl) ...@@ -620,12 +620,12 @@ static void locks_delete_global_locks(struct file_lock *fl)
* is done while holding the flc_lock, and new insertions into the list * is done while holding the flc_lock, and new insertions into the list
* also require that it be held. * also require that it be held.
*/ */
if (hlist_unhashed(&fl->c.flc_link)) if (hlist_unhashed(&flc->flc_link))
return; return;
fll = per_cpu_ptr(&file_lock_list, fl->c.flc_link_cpu); fll = per_cpu_ptr(&file_lock_list, flc->flc_link_cpu);
spin_lock(&fll->lock); spin_lock(&fll->lock);
hlist_del_init(&fl->c.flc_link); hlist_del_init(&flc->flc_link);
spin_unlock(&fll->lock); spin_unlock(&fll->lock);
} }
...@@ -814,13 +814,13 @@ static void ...@@ -814,13 +814,13 @@ static void
locks_insert_lock_ctx(struct file_lock *fl, struct list_head *before) locks_insert_lock_ctx(struct file_lock *fl, struct list_head *before)
{ {
list_add_tail(&fl->c.flc_list, before); list_add_tail(&fl->c.flc_list, before);
locks_insert_global_locks(fl); locks_insert_global_locks(&fl->c);
} }
static void static void
locks_unlink_lock_ctx(struct file_lock *fl) locks_unlink_lock_ctx(struct file_lock *fl)
{ {
locks_delete_global_locks(fl); locks_delete_global_locks(&fl->c);
list_del_init(&fl->c.flc_list); list_del_init(&fl->c.flc_list);
locks_wake_up_blocks(fl); locks_wake_up_blocks(fl);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment