[PATCH 14/20] filelock: convert fl_blocker to file_lock_core

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Both locks and leases deal with fl_blocker. Switch the fl_blocker
pointer in struct file_lock_core to point to the file_lock_core of the
blocker instead of a file_lock structure.

Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
 fs/locks.c                      | 10 +++++-----
 include/linux/filelock.h        |  2 +-
 include/trace/events/filelock.h |  4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 280149860d5e..1bc69a96b96d 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -433,7 +433,7 @@ static void locks_move_blocks(struct file_lock *new, struct file_lock *fl)
 			 &new->fl_core.fl_blocked_requests);
 	list_for_each_entry(f, &new->fl_core.fl_blocked_requests,
 			    fl_core.fl_blocked_member)
-		f->fl_core.fl_blocker = new;
+		f->fl_core.fl_blocker = &new->fl_core;
 	spin_unlock(&blocked_lock_lock);
 }
 
@@ -796,7 +796,7 @@ static void __locks_insert_block(struct file_lock *blocker_fl,
 			blocker =  flc;
 			goto new_blocker;
 		}
-	waiter->fl_blocker = file_lock(blocker);
+	waiter->fl_blocker = blocker;
 	list_add_tail(&waiter->fl_blocked_member,
 		      &blocker->fl_blocked_requests);
 
@@ -1019,7 +1019,7 @@ static struct file_lock_core *what_owner_is_waiting_for(struct file_lock_core *b
 	hash_for_each_possible(blocked_hash, flc, fl_link, posix_owner_key(blocker)) {
 		if (posix_same_owner(flc, blocker)) {
 			while (flc->fl_blocker)
-				flc = &flc->fl_blocker->fl_core;
+				flc = flc->fl_blocker;
 			return flc;
 		}
 	}
@@ -2817,7 +2817,7 @@ static struct file_lock *get_next_blocked_member(struct file_lock *node)
 
 	/* Next member in the linked list could be itself */
 	tmp = list_next_entry(node, fl_core.fl_blocked_member);
-	if (list_entry_is_head(tmp, &node->fl_core.fl_blocker->fl_core.fl_blocked_requests,
+	if (list_entry_is_head(tmp, &node->fl_core.fl_blocker->fl_blocked_requests,
 			       fl_core.fl_blocked_member)
 		|| tmp == node) {
 		return NULL;
@@ -2860,7 +2860,7 @@ static int locks_show(struct seq_file *f, void *v)
 			tmp = get_next_blocked_member(cur);
 			/* Fall back to parent node */
 			while (tmp == NULL && cur->fl_core.fl_blocker != NULL) {
-				cur = cur->fl_core.fl_blocker;
+				cur = file_lock(cur->fl_core.fl_blocker);
 				level--;
 				tmp = get_next_blocked_member(cur);
 			}
diff --git a/include/linux/filelock.h b/include/linux/filelock.h
index 7825511c1c11..9cf1ee3efeda 100644
--- a/include/linux/filelock.h
+++ b/include/linux/filelock.h
@@ -87,7 +87,7 @@ bool opens_in_grace(struct net *);
  */
 
 struct file_lock_core {
-	struct file_lock *fl_blocker;	/* The lock that is blocking us */
+	struct file_lock_core *fl_blocker;	/* The lock that is blocking us */
 	struct list_head fl_list;	/* link into file_lock_context */
 	struct hlist_node fl_link;	/* node in global lists */
 	struct list_head fl_blocked_requests;	/* list of requests with
diff --git a/include/trace/events/filelock.h b/include/trace/events/filelock.h
index 92ed07544f94..49263b69215e 100644
--- a/include/trace/events/filelock.h
+++ b/include/trace/events/filelock.h
@@ -68,7 +68,7 @@ DECLARE_EVENT_CLASS(filelock_lock,
 		__field(struct file_lock *, fl)
 		__field(unsigned long, i_ino)
 		__field(dev_t, s_dev)
-		__field(struct file_lock *, fl_blocker)
+		__field(struct file_lock_core *, fl_blocker)
 		__field(fl_owner_t, fl_owner)
 		__field(unsigned int, fl_pid)
 		__field(unsigned int, fl_flags)
@@ -125,7 +125,7 @@ DECLARE_EVENT_CLASS(filelock_lease,
 		__field(struct file_lock *, fl)
 		__field(unsigned long, i_ino)
 		__field(dev_t, s_dev)
-		__field(struct file_lock *, fl_blocker)
+		__field(struct file_lock_core *, fl_blocker)
 		__field(fl_owner_t, fl_owner)
 		__field(unsigned int, fl_flags)
 		__field(unsigned char, fl_type)

-- 
2.43.0





[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux