diff options
author | Jeff Layton <jlayton@primarydata.com> | 2015-01-16 21:05:55 +0100 |
---|---|---|
committer | Jeff Layton <jeff.layton@primarydata.com> | 2015-01-16 21:09:25 +0100 |
commit | 5263e31e452fb84138b9bee061d5c06c0f359fea (patch) | |
tree | 68726ce860d2c824f605e6ec3f2adc9187d6dc86 /fs/ceph | |
parent | ceph: move spinlocking into ceph_encode_locks_to_buffer and ceph_count_locks (diff) | |
download | linux-5263e31e452fb84138b9bee061d5c06c0f359fea.tar.xz linux-5263e31e452fb84138b9bee061d5c06c0f359fea.zip |
locks: move flock locks to file_lock_context
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 | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c index 366dc2412605..917656ea8dcf 100644 --- a/fs/ceph/locks.c +++ b/fs/ceph/locks.c @@ -239,14 +239,16 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl) return err; } -/** - * Must be called with lock_flocks() already held. Fills in the passed - * counter variables, so you can prepare pagelist metadata before calling - * ceph_encode_locks. +/* + * 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; *flock_count = 0; @@ -255,7 +257,11 @@ void ceph_count_locks(struct inode *inode, int *fcntl_count, int *flock_count) for (lock = inode->i_flock; lock != NULL; lock = lock->fl_next) { if (lock->fl_flags & FL_POSIX) ++(*fcntl_count); - else if (lock->fl_flags & FL_FLOCK) + } + + ctx = inode->i_flctx; + if (ctx) { + list_for_each_entry(lock, &ctx->flc_flock, fl_list) ++(*flock_count); } spin_unlock(&inode->i_lock); @@ -273,6 +279,7 @@ int ceph_encode_locks_to_buffer(struct inode *inode, int num_fcntl_locks, int num_flock_locks) { struct file_lock *lock; + struct file_lock_context *ctx; int err = 0; int seen_fcntl = 0; int seen_flock = 0; @@ -295,8 +302,10 @@ int ceph_encode_locks_to_buffer(struct inode *inode, ++l; } } - for (lock = inode->i_flock; lock != NULL; lock = lock->fl_next) { - if (lock->fl_flags & FL_FLOCK) { + + ctx = inode->i_flctx; + if (ctx) { + list_for_each_entry(lock, &ctx->flc_flock, fl_list) { ++seen_flock; if (seen_flock > num_flock_locks) { err = -ENOSPC; |