mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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>
This commit is contained in:
parent
7448cc37b1
commit
9bd0f45b70
4 changed files with 38 additions and 35 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue