diff mbox series

[15/20] filelock: clean up locks_delete_block internals

Message ID 20240116-flsplit-v1-15-c9d0f4370a5d@kernel.org (mailing list archive)
State New, archived
Headers show
Series filelock: split struct file_lock into file_lock and file_lease structs | expand

Commit Message

Jeff Layton Jan. 16, 2024, 7:46 p.m. UTC
Rework the internals of locks_delete_block to use struct file_lock_core
(mostly just for clarity's sake). The prototype is not changed.

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

Patch

diff --git a/fs/locks.c b/fs/locks.c
index 1bc69a96b96d..3a028a8aafeb 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -720,9 +720,10 @@  static void __locks_wake_up_blocks(struct file_lock_core *blocker)
  *
  *	lockd/nfsd need to disconnect the lock while working on it.
  */
-int locks_delete_block(struct file_lock *waiter)
+int locks_delete_block(struct file_lock *waiter_fl)
 {
 	int status = -ENOENT;
+	struct file_lock_core *waiter = &waiter_fl->fl_core;
 
 	/*
 	 * If fl_blocker is NULL, it won't be set again as this thread "owns"
@@ -745,21 +746,21 @@  int locks_delete_block(struct file_lock *waiter)
 	 * no new locks can be inserted into its fl_blocked_requests list, and
 	 * can avoid doing anything further if the list is empty.
 	 */
-	if (!smp_load_acquire(&waiter->fl_core.fl_blocker) &&
-	    list_empty(&waiter->fl_core.fl_blocked_requests))
+	if (!smp_load_acquire(&waiter->fl_blocker) &&
+	    list_empty(&waiter->fl_blocked_requests))
 		return status;
 
 	spin_lock(&blocked_lock_lock);
-	if (waiter->fl_core.fl_blocker)
+	if (waiter->fl_blocker)
 		status = 0;
-	__locks_wake_up_blocks(&waiter->fl_core);
-	__locks_delete_block(&waiter->fl_core);
+	__locks_wake_up_blocks(waiter);
+	__locks_delete_block(waiter);
 
 	/*
 	 * The setting of fl_blocker to NULL marks the "done" point in deleting
 	 * a block. Paired with acquire at the top of this function.
 	 */
-	smp_store_release(&waiter->fl_core.fl_blocker, NULL);
+	smp_store_release(waiter->fl_blocker, NULL);
 	spin_unlock(&blocked_lock_lock);
 	return status;
 }