[PATCH v2 03/10] locks: add a new struct file_locking_context pointer to struct inode

2015-01-08 Thread Jeff Layton
The current scheme of using the i_flock list is really difficult to manage. There is also a legitimate desire for a per-inode spinlock to manage these lists that isn't the i_lock. Start conversion to a new scheme to eventually replace the old i_flock list with a new file_lock_context object. We

[PATCH v2 00/10] locks: saner method for managing file locks

2015-01-08 Thread Jeff Layton
v2: - bugfix to the flc_posix list ordering that broke the split/merge code - don't use i_lock to manage the i_flctx pointer. Do so locklessly via cmpxchg(). - reordering of the patches to make the set bisectable. As a result the new spinlock is not introduced until near the end of the set -

[PATCH v2 10/10] locks: keep a count of locks on the flctx lists

2015-01-08 Thread Jeff Layton
This makes things a bit more efficient in the cifs and ceph lock pushing code. Signed-off-by: Jeff Layton jlay...@primarydata.com --- fs/ceph/locks.c| 11 ++- fs/cifs/file.c | 14 -- fs/locks.c | 38 ++ include/linux/fs.h |

[PATCH v2 05/10] locks: convert posix locks to file_lock_context

2015-01-08 Thread Jeff Layton
Signed-off-by: Jeff Layton jlay...@primarydata.com --- fs/ceph/locks.c | 58 +--- fs/cifs/file.c | 26 + fs/lockd/svcsubs.c | 20 ++ fs/locks.c | 108 +++- fs/nfs/delegation.c | 27

[PATCH v2 07/10] locks: remove i_flock field from struct inode

2015-01-08 Thread Jeff Layton
Nothing uses it anymore. Also add a forward declaration for struct file_lock to silence some compiler warnings that the removal triggers. Signed-off-by: Jeff Layton jlay...@primarydata.com --- include/linux/fs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH v2 06/10] locks: convert lease handling to file_lock_context

2015-01-08 Thread Jeff Layton
Signed-off-by: Jeff Layton jlay...@primarydata.com --- fs/locks.c | 251 + include/linux/fs.h | 5 +- 2 files changed, 101 insertions(+), 155 deletions(-) diff --git a/fs/locks.c b/fs/locks.c index fadf50297e5c..acfad02bc136 100644

[PATCH v2 08/10] locks: add a dedicated spinlock to protect i_flctx lists

2015-01-08 Thread Jeff Layton
We can now add a dedicated spinlock without expanding struct inode. Change to using that to protect the various i_flctx lists. We do still use the i_lock to protect the i_flctx pointer itself, but once the context is assigned to the inode we no longer need it. Signed-off-by: Jeff Layton

[PATCH v2 04/10] locks: move flock locks to file_lock_context

2015-01-08 Thread Jeff Layton
Signed-off-by: Jeff Layton jlay...@primarydata.com --- fs/ceph/locks.c | 28 --- fs/ceph/mds_client.c | 4 fs/locks.c | 53 +--- fs/nfs/delegation.c | 18 -- fs/nfs/nfs4state.c | 42

[PATCH v2 02/10] locks: have locks_release_file use flock_lock_file to release generic flock locks

2015-01-08 Thread Jeff Layton
...instead of open-coding it and removing flock locks directly. This simplifies some coming interim changes in the following patches when we have different file_lock types protected by different spinlocks. Signed-off-by: Jeff Layton jlay...@primarydata.com --- fs/locks.c | 49