[PATCH 05/20] filelock: convert some internal functions to use file_lock_core instead

Jeff Layton
2024-01-16T19:47:06Z

Convert some internal fs/locks.c function to take and deal with struct
file_lock_core instead of struct file_lock:

- locks_init_lock_heads
- locks_alloc_lock
- locks_init_lock

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/locks.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index afe6e82a6207..42221cecd331 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -258,13 +258,13 @@ locks_free_lock_context(struct inode *inode)
}
}

-static void locks_init_lock_heads(struct file_lock *fl)
+static void locks_init_lock_heads(struct file_lock_core *flc)
{
- INIT_HLIST_NODE(&fl->fl_core.fl_link);
- INIT_LIST_HEAD(&fl->fl_core.fl_list);
- INIT_LIST_HEAD(&fl->fl_core.fl_blocked_requests);
- INIT_LIST_HEAD(&fl->fl_core.fl_blocked_member);
- init_waitqueue_head(&fl->fl_core.fl_wait);
+ INIT_HLIST_NODE(&flc->fl_link);
+ INIT_LIST_HEAD(&flc->fl_list);
+ INIT_LIST_HEAD(&flc->fl_blocked_requests);
+ INIT_LIST_HEAD(&flc->fl_blocked_member);
+ init_waitqueue_head(&flc->fl_wait);
}

/* Allocate an empty lock structure. */
@@ -273,7 +273,7 @@ struct file_lock *locks_alloc_lock(void)
struct file_lock *fl = kmem_cache_zalloc(filelock_cache, GFP_KERNEL);

if (fl)
- locks_init_lock_heads(fl);
+ locks_init_lock_heads(&fl->fl_core);

return fl;
}
@@ -354,7 +354,7 @@ locks_dispose_list(struct list_head *dispose)
void locks_init_lock(struct file_lock *fl)
{
memset(fl, 0, sizeof(struct file_lock));
- locks_init_lock_heads(fl);
+ locks_init_lock_heads(&fl->fl_core);
}
EXPORT_SYMBOL(locks_init_lock);

--
2.43.0