locks: add a dedicated spinlock to protect i_flctx lists
authorJeff Layton <jlayton@primarydata.com>
Fri, 16 Jan 2015 20:05:57 +0000 (15:05 -0500)
committerJeff Layton <jeff.layton@primarydata.com>
Fri, 16 Jan 2015 21:08:49 +0000 (16:08 -0500)
We can now add a dedicated spinlock without expanding struct inode.
Change to using that to protect the various i_flctx lists.

Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Acked-by: Christoph Hellwig <hch@lst.de>
fs/ceph/locks.c
fs/cifs/file.c
fs/lockd/svcsubs.c
fs/locks.c
fs/nfs/delegation.c
fs/nfs/nfs4state.c
fs/nfs/write.c
fs/nfsd/nfs4state.c
include/linux/fs.h

index 19beeed..0303da8 100644 (file)
@@ -255,12 +255,12 @@ void ceph_count_locks(struct inode *inode, int *fcntl_count, int *flock_count)
 
        ctx = inode->i_flctx;
        if (ctx) {
-               spin_lock(&inode->i_lock);
+               spin_lock(&ctx->flc_lock);
                list_for_each_entry(lock, &ctx->flc_posix, fl_list)
                        ++(*fcntl_count);
                list_for_each_entry(lock, &ctx->flc_flock, fl_list)
                        ++(*flock_count);
-               spin_unlock(&inode->i_lock);
+               spin_unlock(&ctx->flc_lock);
        }
        dout("counted %d flock locks and %d fcntl locks",
             *flock_count, *fcntl_count);
@@ -288,7 +288,7 @@ int ceph_encode_locks_to_buffer(struct inode *inode,
        if (!ctx)
                return 0;
 
-       spin_lock(&inode->i_lock);
+       spin_lock(&ctx->flc_lock);
        list_for_each_entry(lock, &ctx->flc_flock, fl_list) {
                ++seen_fcntl;
                if (seen_fcntl > num_fcntl_locks) {
@@ -312,7 +312,7 @@ int ceph_encode_locks_to_buffer(struct inode *inode,
                ++l;
        }
 fail:
-       spin_unlock(&inode->i_lock);
+       spin_unlock(&ctx->flc_lock);
        return err;
 }
 
index ea78f6f..b65166e 100644 (file)
@@ -1136,11 +1136,11 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile)
        if (!flctx)
                goto out;
 
-       spin_lock(&inode->i_lock);
+       spin_lock(&flctx->flc_lock);
        list_for_each(el, &flctx->flc_posix) {
                count++;
        }
-       spin_unlock(&inode->i_lock);
+       spin_unlock(&flctx->flc_lock);
 
        INIT_LIST_HEAD(&locks_to_send);
 
@@ -1159,7 +1159,7 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile)
        }
 
        el = locks_to_send.next;
-       spin_lock(&inode->i_lock);
+       spin_lock(&flctx->flc_lock);
        list_for_each_entry(flock, &flctx->flc_posix, fl_list) {
                if (el == &locks_to_send) {
                        /*
@@ -1181,7 +1181,7 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile)
                lck->type = type;
                lck->offset = flock->fl_start;
        }
-       spin_unlock(&inode->i_lock);
+       spin_unlock(&flctx->flc_lock);
 
        list_for_each_entry_safe(lck, tmp, &locks_to_send, llist) {
                int stored_rc;
Simple merge
diff --cc fs/locks.c
Simple merge
Simple merge
Simple merge
diff --cc fs/nfs/write.c
Simple merge
Simple merge
Simple merge