diff options
author | Jeff Layton <jlayton@primarydata.com> | 2015-01-16 15:05:55 -0500 |
---|---|---|
committer | Jeff Layton <jeff.layton@primarydata.com> | 2015-01-16 15:09:25 -0500 |
commit | c362781cadd37858c3d8f5d18b1e9957d4671298 (patch) | |
tree | ad072eccf039314a24ad9314e7e249722d44ddb8 /fs/ceph/locks.c | |
parent | 4a075e39c86490cc0f0c10ac6abe3592d1689463 (diff) |
ceph: move spinlocking into ceph_encode_locks_to_buffer and ceph_count_locks
There is only a single call site for each of these functions, and the
caller takes the i_lock prior to calling them and drops it just
afterward. Move the spinlocking into the functions instead.
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 | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c index c35c5c614e38..366dc2412605 100644 --- a/fs/ceph/locks.c +++ b/fs/ceph/locks.c | |||
@@ -251,12 +251,14 @@ void ceph_count_locks(struct inode *inode, int *fcntl_count, int *flock_count) | |||
251 | *fcntl_count = 0; | 251 | *fcntl_count = 0; |
252 | *flock_count = 0; | 252 | *flock_count = 0; |
253 | 253 | ||
254 | spin_lock(&inode->i_lock); | ||
254 | for (lock = inode->i_flock; lock != NULL; lock = lock->fl_next) { | 255 | for (lock = inode->i_flock; lock != NULL; lock = lock->fl_next) { |
255 | if (lock->fl_flags & FL_POSIX) | 256 | if (lock->fl_flags & FL_POSIX) |
256 | ++(*fcntl_count); | 257 | ++(*fcntl_count); |
257 | else if (lock->fl_flags & FL_FLOCK) | 258 | else if (lock->fl_flags & FL_FLOCK) |
258 | ++(*flock_count); | 259 | ++(*flock_count); |
259 | } | 260 | } |
261 | spin_unlock(&inode->i_lock); | ||
260 | dout("counted %d flock locks and %d fcntl locks", | 262 | dout("counted %d flock locks and %d fcntl locks", |
261 | *flock_count, *fcntl_count); | 263 | *flock_count, *fcntl_count); |
262 | } | 264 | } |
@@ -279,6 +281,7 @@ int ceph_encode_locks_to_buffer(struct inode *inode, | |||
279 | dout("encoding %d flock and %d fcntl locks", num_flock_locks, | 281 | dout("encoding %d flock and %d fcntl locks", num_flock_locks, |
280 | num_fcntl_locks); | 282 | num_fcntl_locks); |
281 | 283 | ||
284 | spin_lock(&inode->i_lock); | ||
282 | for (lock = inode->i_flock; lock != NULL; lock = lock->fl_next) { | 285 | for (lock = inode->i_flock; lock != NULL; lock = lock->fl_next) { |
283 | if (lock->fl_flags & FL_POSIX) { | 286 | if (lock->fl_flags & FL_POSIX) { |
284 | ++seen_fcntl; | 287 | ++seen_fcntl; |
@@ -306,6 +309,7 @@ int ceph_encode_locks_to_buffer(struct inode *inode, | |||
306 | } | 309 | } |
307 | } | 310 | } |
308 | fail: | 311 | fail: |
312 | spin_unlock(&inode->i_lock); | ||
309 | return err; | 313 | return err; |
310 | } | 314 | } |
311 | 315 | ||