aboutsummaryrefslogtreecommitdiffstats
path: root/fs/locks.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2011-07-20 20:21:59 -0400
committerJ. Bruce Fields <bfields@redhat.com>2011-07-20 20:23:19 -0400
commit8fb47a4fbf858a164e973b8ea8ef5e83e61f2e50 (patch)
treed3b55fbce0e7ba5708a55b91b1ab4079ad192db6 /fs/locks.c
parentc46556c6be057da79f51b1a8325ec4c27938bd49 (diff)
locks: rename lock-manager ops
Both the filesystem and the lock manager can associate operations with a lock. Confusingly, one of them (fl_release_private) actually has the same name in both operation structures. It would save some confusion to give the lock-manager ops different names. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/locks.c')
-rw-r--r--fs/locks.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/fs/locks.c b/fs/locks.c
index 7ddab3f9df07..703f545097de 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -187,8 +187,8 @@ void locks_release_private(struct file_lock *fl)
187 fl->fl_ops = NULL; 187 fl->fl_ops = NULL;
188 } 188 }
189 if (fl->fl_lmops) { 189 if (fl->fl_lmops) {
190 if (fl->fl_lmops->fl_release_private) 190 if (fl->fl_lmops->lm_release_private)
191 fl->fl_lmops->fl_release_private(fl); 191 fl->fl_lmops->lm_release_private(fl);
192 fl->fl_lmops = NULL; 192 fl->fl_lmops = NULL;
193 } 193 }
194 194
@@ -423,9 +423,9 @@ static void lease_release_private_callback(struct file_lock *fl)
423} 423}
424 424
425static const struct lock_manager_operations lease_manager_ops = { 425static const struct lock_manager_operations lease_manager_ops = {
426 .fl_break = lease_break_callback, 426 .lm_break = lease_break_callback,
427 .fl_release_private = lease_release_private_callback, 427 .lm_release_private = lease_release_private_callback,
428 .fl_change = lease_modify, 428 .lm_change = lease_modify,
429}; 429};
430 430
431/* 431/*
@@ -478,9 +478,9 @@ static inline int locks_overlap(struct file_lock *fl1, struct file_lock *fl2)
478 */ 478 */
479static int posix_same_owner(struct file_lock *fl1, struct file_lock *fl2) 479static int posix_same_owner(struct file_lock *fl1, struct file_lock *fl2)
480{ 480{
481 if (fl1->fl_lmops && fl1->fl_lmops->fl_compare_owner) 481 if (fl1->fl_lmops && fl1->fl_lmops->lm_compare_owner)
482 return fl2->fl_lmops == fl1->fl_lmops && 482 return fl2->fl_lmops == fl1->fl_lmops &&
483 fl1->fl_lmops->fl_compare_owner(fl1, fl2); 483 fl1->fl_lmops->lm_compare_owner(fl1, fl2);
484 return fl1->fl_owner == fl2->fl_owner; 484 return fl1->fl_owner == fl2->fl_owner;
485} 485}
486 486
@@ -530,8 +530,8 @@ static void locks_wake_up_blocks(struct file_lock *blocker)
530 waiter = list_first_entry(&blocker->fl_block, 530 waiter = list_first_entry(&blocker->fl_block,
531 struct file_lock, fl_block); 531 struct file_lock, fl_block);
532 __locks_delete_block(waiter); 532 __locks_delete_block(waiter);
533 if (waiter->fl_lmops && waiter->fl_lmops->fl_notify) 533 if (waiter->fl_lmops && waiter->fl_lmops->lm_notify)
534 waiter->fl_lmops->fl_notify(waiter); 534 waiter->fl_lmops->lm_notify(waiter);
535 else 535 else
536 wake_up(&waiter->fl_wait); 536 wake_up(&waiter->fl_wait);
537 } 537 }
@@ -1218,7 +1218,7 @@ int __break_lease(struct inode *inode, unsigned int mode)
1218 fl->fl_type = future; 1218 fl->fl_type = future;
1219 fl->fl_break_time = break_time; 1219 fl->fl_break_time = break_time;
1220 /* lease must have lmops break callback */ 1220 /* lease must have lmops break callback */
1221 fl->fl_lmops->fl_break(fl); 1221 fl->fl_lmops->lm_break(fl);
1222 } 1222 }
1223 } 1223 }
1224 1224
@@ -1328,7 +1328,7 @@ int fcntl_getlease(struct file *filp)
1328 * @arg: type of lease to obtain 1328 * @arg: type of lease to obtain
1329 * @flp: input - file_lock to use, output - file_lock inserted 1329 * @flp: input - file_lock to use, output - file_lock inserted
1330 * 1330 *
1331 * The (input) flp->fl_lmops->fl_break function is required 1331 * The (input) flp->fl_lmops->lm_break function is required
1332 * by break_lease(). 1332 * by break_lease().
1333 * 1333 *
1334 * Called with file_lock_lock held. 1334 * Called with file_lock_lock held.
@@ -1354,7 +1354,7 @@ int generic_setlease(struct file *filp, long arg, struct file_lock **flp)
1354 1354
1355 time_out_leases(inode); 1355 time_out_leases(inode);
1356 1356
1357 BUG_ON(!(*flp)->fl_lmops->fl_break); 1357 BUG_ON(!(*flp)->fl_lmops->lm_break);
1358 1358
1359 if (arg != F_UNLCK) { 1359 if (arg != F_UNLCK) {
1360 error = -EAGAIN; 1360 error = -EAGAIN;
@@ -1396,7 +1396,7 @@ int generic_setlease(struct file *filp, long arg, struct file_lock **flp)
1396 goto out; 1396 goto out;
1397 1397
1398 if (my_before != NULL) { 1398 if (my_before != NULL) {
1399 error = lease->fl_lmops->fl_change(my_before, arg); 1399 error = lease->fl_lmops->lm_change(my_before, arg);
1400 if (!error) 1400 if (!error)
1401 *flp = *my_before; 1401 *flp = *my_before;
1402 goto out; 1402 goto out;
@@ -1432,7 +1432,7 @@ static int __vfs_setlease(struct file *filp, long arg, struct file_lock **lease)
1432 * @lease: file_lock to use 1432 * @lease: file_lock to use
1433 * 1433 *
1434 * Call this to establish a lease on the file. 1434 * Call this to establish a lease on the file.
1435 * The (*lease)->fl_lmops->fl_break operation must be set; if not, 1435 * The (*lease)->fl_lmops->lm_break operation must be set; if not,
1436 * break_lease will oops! 1436 * break_lease will oops!
1437 * 1437 *
1438 * This will call the filesystem's setlease file method, if 1438 * This will call the filesystem's setlease file method, if
@@ -1730,10 +1730,10 @@ out:
1730 * To avoid blocking kernel daemons, such as lockd, that need to acquire POSIX 1730 * To avoid blocking kernel daemons, such as lockd, that need to acquire POSIX
1731 * locks, the ->lock() interface may return asynchronously, before the lock has 1731 * locks, the ->lock() interface may return asynchronously, before the lock has
1732 * been granted or denied by the underlying filesystem, if (and only if) 1732 * been granted or denied by the underlying filesystem, if (and only if)
1733 * fl_grant is set. Callers expecting ->lock() to return asynchronously 1733 * lm_grant is set. Callers expecting ->lock() to return asynchronously
1734 * will only use F_SETLK, not F_SETLKW; they will set FL_SLEEP if (and only if) 1734 * will only use F_SETLK, not F_SETLKW; they will set FL_SLEEP if (and only if)
1735 * the request is for a blocking lock. When ->lock() does return asynchronously, 1735 * the request is for a blocking lock. When ->lock() does return asynchronously,
1736 * it must return FILE_LOCK_DEFERRED, and call ->fl_grant() when the lock 1736 * it must return FILE_LOCK_DEFERRED, and call ->lm_grant() when the lock
1737 * request completes. 1737 * request completes.
1738 * If the request is for non-blocking lock the file system should return 1738 * If the request is for non-blocking lock the file system should return
1739 * FILE_LOCK_DEFERRED then try to get the lock and call the callback routine 1739 * FILE_LOCK_DEFERRED then try to get the lock and call the callback routine
@@ -1743,7 +1743,7 @@ out:
1743 * grants a lock so the VFS can find out which locks are locally held and do 1743 * grants a lock so the VFS can find out which locks are locally held and do
1744 * the correct lock cleanup when required. 1744 * the correct lock cleanup when required.
1745 * The underlying filesystem must not drop the kernel lock or call 1745 * The underlying filesystem must not drop the kernel lock or call
1746 * ->fl_grant() before returning to the caller with a FILE_LOCK_DEFERRED 1746 * ->lm_grant() before returning to the caller with a FILE_LOCK_DEFERRED
1747 * return code. 1747 * return code.
1748 */ 1748 */
1749int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf) 1749int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf)