aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Layton <jlayton@primarydata.com>2015-01-16 15:05:54 -0500
committerJeff Layton <jlayton@primarydata.com>2015-01-16 15:05:54 -0500
commit6dee60f69d48fcef021b4b53b3431797ec440764 (patch)
treed5d8dbc3321788c3d5c0ee146f8219b50a295417
parentcb59670870d90ff8bc31f5f2efc407c6fe4938c0 (diff)
locks: add new struct list_head to struct file_lock
...that we can use to queue file_locks to per-ctx list_heads. Go ahead and convert locks_delete_lock and locks_dispose_list to use it instead of the fl_block list. Signed-off-by: Jeff Layton <jlayton@primarydata.com> Acked-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--fs/locks.c8
-rw-r--r--include/linux/fs.h1
2 files changed, 6 insertions, 3 deletions
diff --git a/fs/locks.c b/fs/locks.c
index 59e2f905e4ff..bfe5f17401de 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -207,6 +207,7 @@ static struct kmem_cache *filelock_cache __read_mostly;
207static void locks_init_lock_heads(struct file_lock *fl) 207static void locks_init_lock_heads(struct file_lock *fl)
208{ 208{
209 INIT_HLIST_NODE(&fl->fl_link); 209 INIT_HLIST_NODE(&fl->fl_link);
210 INIT_LIST_HEAD(&fl->fl_list);
210 INIT_LIST_HEAD(&fl->fl_block); 211 INIT_LIST_HEAD(&fl->fl_block);
211 init_waitqueue_head(&fl->fl_wait); 212 init_waitqueue_head(&fl->fl_wait);
212} 213}
@@ -243,6 +244,7 @@ EXPORT_SYMBOL_GPL(locks_release_private);
243void locks_free_lock(struct file_lock *fl) 244void locks_free_lock(struct file_lock *fl)
244{ 245{
245 BUG_ON(waitqueue_active(&fl->fl_wait)); 246 BUG_ON(waitqueue_active(&fl->fl_wait));
247 BUG_ON(!list_empty(&fl->fl_list));
246 BUG_ON(!list_empty(&fl->fl_block)); 248 BUG_ON(!list_empty(&fl->fl_block));
247 BUG_ON(!hlist_unhashed(&fl->fl_link)); 249 BUG_ON(!hlist_unhashed(&fl->fl_link));
248 250
@@ -257,8 +259,8 @@ locks_dispose_list(struct list_head *dispose)
257 struct file_lock *fl; 259 struct file_lock *fl;
258 260
259 while (!list_empty(dispose)) { 261 while (!list_empty(dispose)) {
260 fl = list_first_entry(dispose, struct file_lock, fl_block); 262 fl = list_first_entry(dispose, struct file_lock, fl_list);
261 list_del_init(&fl->fl_block); 263 list_del_init(&fl->fl_list);
262 locks_free_lock(fl); 264 locks_free_lock(fl);
263 } 265 }
264} 266}
@@ -691,7 +693,7 @@ static void locks_delete_lock(struct file_lock **thisfl_p,
691 693
692 locks_unlink_lock(thisfl_p); 694 locks_unlink_lock(thisfl_p);
693 if (dispose) 695 if (dispose)
694 list_add(&fl->fl_block, dispose); 696 list_add(&fl->fl_list, dispose);
695 else 697 else
696 locks_free_lock(fl); 698 locks_free_lock(fl);
697} 699}
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 42efe13077b6..cd6818115162 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -934,6 +934,7 @@ int locks_in_grace(struct net *);
934 */ 934 */
935struct file_lock { 935struct file_lock {
936 struct file_lock *fl_next; /* singly linked list for this inode */ 936 struct file_lock *fl_next; /* singly linked list for this inode */
937 struct list_head fl_list; /* link into file_lock_context */
937 struct hlist_node fl_link; /* node in global lists */ 938 struct hlist_node fl_link; /* node in global lists */
938 struct list_head fl_block; /* circular list of blocked processes */ 939 struct list_head fl_block; /* circular list of blocked processes */
939 fl_owner_t fl_owner; 940 fl_owner_t fl_owner;