diff options
author | Jeff Layton <jlayton@primarydata.com> | 2015-01-16 21:05:57 +0100 |
---|---|---|
committer | Jeff Layton <jeff.layton@primarydata.com> | 2015-01-16 22:08:50 +0100 |
commit | 9bd0f45b7037fcfa8b575c7e27d0431d6e6dc3bb (patch) | |
tree | 205f3c2107cec0323dc25c959fefcc4fd709fa49 /fs/ceph | |
parent | locks: clean up the lm_change prototype (diff) | |
download | linux-9bd0f45b7037fcfa8b575c7e27d0431d6e6dc3bb.tar.xz linux-9bd0f45b7037fcfa8b575c7e27d0431d6e6dc3bb.zip |
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')
-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 0303da8e3233..06ea5cd05cd9 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); |