linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@primarydata.com>
To: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, linux-cifs@vger.kernel.org,
	linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org,
	hch@infradead.org
Subject: [PATCH v2 01/10] locks: add new struct list_head to struct file_lock
Date: Thu,  8 Jan 2015 10:34:16 -0800	[thread overview]
Message-ID: <1420742065-28423-2-git-send-email-jlayton@primarydata.com> (raw)
In-Reply-To: <1420742065-28423-1-git-send-email-jlayton@primarydata.com>

...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>
---
 fs/locks.c         | 8 +++++---
 include/linux/fs.h | 1 +
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 735b8d3fa78c..fba8bc7af6d3 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -207,6 +207,7 @@ static struct kmem_cache *filelock_cache __read_mostly;
 static void locks_init_lock_heads(struct file_lock *fl)
 {
 	INIT_HLIST_NODE(&fl->fl_link);
+	INIT_LIST_HEAD(&fl->fl_list);
 	INIT_LIST_HEAD(&fl->fl_block);
 	init_waitqueue_head(&fl->fl_wait);
 }
@@ -243,6 +244,7 @@ EXPORT_SYMBOL_GPL(locks_release_private);
 void locks_free_lock(struct file_lock *fl)
 {
 	BUG_ON(waitqueue_active(&fl->fl_wait));
+	BUG_ON(!list_empty(&fl->fl_list));
 	BUG_ON(!list_empty(&fl->fl_block));
 	BUG_ON(!hlist_unhashed(&fl->fl_link));
 
@@ -257,8 +259,8 @@ locks_dispose_list(struct list_head *dispose)
 	struct file_lock *fl;
 
 	while (!list_empty(dispose)) {
-		fl = list_first_entry(dispose, struct file_lock, fl_block);
-		list_del_init(&fl->fl_block);
+		fl = list_first_entry(dispose, struct file_lock, fl_list);
+		list_del_init(&fl->fl_list);
 		locks_free_lock(fl);
 	}
 }
@@ -691,7 +693,7 @@ static void locks_delete_lock(struct file_lock **thisfl_p,
 
 	locks_unlink_lock(thisfl_p);
 	if (dispose)
-		list_add(&fl->fl_block, dispose);
+		list_add(&fl->fl_list, dispose);
 	else
 		locks_free_lock(fl);
 }
diff --git a/include/linux/fs.h b/include/linux/fs.h
index f90c0282c114..9eee7200cfe3 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -934,6 +934,7 @@ int locks_in_grace(struct net *);
  */
 struct file_lock {
 	struct file_lock *fl_next;	/* singly linked list for this inode  */
+	struct list_head fl_list;	/* link into file_lock_context */
 	struct hlist_node fl_link;	/* node in global lists */
 	struct list_head fl_block;	/* circular list of blocked processes */
 	fl_owner_t fl_owner;
-- 
2.1.0

  reply	other threads:[~2015-01-08 18:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-08 18:34 [PATCH v2 00/10] locks: saner method for managing file locks Jeff Layton
2015-01-08 18:34 ` Jeff Layton [this message]
2015-01-08 18:34 ` [PATCH v2 02/10] locks: have locks_release_file use flock_lock_file to release generic flock locks Jeff Layton
2015-01-09 14:27   ` Christoph Hellwig
2015-01-09 14:42     ` Jeff Layton
2015-01-09 14:46       ` Christoph Hellwig
2015-01-08 18:34 ` [PATCH v2 03/10] locks: add a new struct file_locking_context pointer to struct inode Jeff Layton
2015-01-08 18:34 ` [PATCH v2 04/10] locks: move flock locks to file_lock_context Jeff Layton
     [not found]   ` <1420742065-28423-5-git-send-email-jlayton-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>
2015-01-09 14:31     ` Christoph Hellwig
2015-01-09 14:47       ` Jeff Layton
2015-01-08 18:34 ` [PATCH v2 05/10] locks: convert posix " Jeff Layton
2015-01-08 18:34 ` [PATCH v2 07/10] locks: remove i_flock field from struct inode Jeff Layton
2015-01-08 18:34 ` [PATCH v2 08/10] locks: add a dedicated spinlock to protect i_flctx lists Jeff Layton
     [not found] ` <1420742065-28423-1-git-send-email-jlayton-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>
2015-01-08 18:34   ` [PATCH v2 06/10] locks: convert lease handling to file_lock_context Jeff Layton
2015-01-08 18:34   ` [PATCH v2 09/10] locks: clean up the lm_change prototype Jeff Layton
2015-01-08 18:34   ` [PATCH v2 10/10] locks: keep a count of locks on the flctx lists Jeff Layton
2015-01-09 17:21   ` [PATCH v2 00/10] locks: saner method for managing file locks Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1420742065-28423-2-git-send-email-jlayton@primarydata.com \
    --to=jlayton@primarydata.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=hch@infradead.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).