diff options
author | Jeff Layton <jlayton@primarydata.com> | 2015-01-16 15:05:57 -0500 |
---|---|---|
committer | Jeff Layton <jeff.layton@primarydata.com> | 2015-01-16 16:08:50 -0500 |
commit | 9bd0f45b7037fcfa8b575c7e27d0431d6e6dc3bb (patch) | |
tree | 205f3c2107cec0323dc25c959fefcc4fd709fa49 /fs/ceph/locks.c | |
parent | 7448cc37b1a6b620d948aaee3bb30960c06d5d5d (diff) | |
download | op-kernel-dev-9bd0f45b7037fcfa8b575c7e27d0431d6e6dc3bb.zip op-kernel-dev-9bd0f45b7037fcfa8b575c7e27d0431d6e6dc3bb.tar.gz |
locks: keep a count of locks on the flctx lists
This makes things a bit more efficient in the cifs and ceph lock
pushing code.
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/ceph/locks.c')
-rw-r--r-- | fs/ceph/locks.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c index 0303da8..06ea5cd 100644 --- a/fs/ceph/locks.c +++ b/fs/ceph/locks.c @@ -242,12 +242,9 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl) /* * Fills in the passed counter variables, so you can prepare pagelist metadata * before calling ceph_encode_locks. - * - * FIXME: add counters to struct file_lock_context so we don't need to do this? */ void ceph_count_locks(struct inode *inode, int *fcntl_count, int *flock_count) { - struct file_lock *lock; struct file_lock_context *ctx; *fcntl_count = 0; @@ -255,12 +252,8 @@ void ceph_count_locks(struct inode *inode, int *fcntl_count, int *flock_count) ctx = inode->i_flctx; if (ctx) { - 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(&ctx->flc_lock); + *fcntl_count = ctx->flc_posix_cnt; + *flock_count = ctx->flc_flock_cnt; } dout("counted %d flock locks and %d fcntl locks", *flock_count, *fcntl_count); |