mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04:00
fs/locks.c: prepare for BKL removal
This prepares the removal of the big kernel lock from the file locking code. We still use the BKL as long as fs/lockd uses it and ceph might sleep, but we can flip the definition to a private spinlock as soon as that's done. All users outside of fs/lockd get converted to use lock_flocks() instead of lock_kernel() where appropriate. Based on an earlier patch to use a spinlock from Matthew Wilcox, who has attempted this a few times before, the earliest patch from over 10 years ago turned it into a semaphore, which ended up being slower than the BKL and was subsequently reverted. Someone should do some serious performance testing when this becomes a spinlock, since this has caused problems before. Using a spinlock should be at least as good as the BKL in theory, but who knows... Signed-off-by: Arnd Bergmann <[email protected]> Acked-by: Matthew Wilcox <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Trond Myklebust <[email protected]> Cc: "J. Bruce Fields" <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Miklos Szeredi <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: John Kacur <[email protected]> Cc: Sage Weil <[email protected]> Cc: [email protected] Cc: [email protected]
This commit is contained in:
parent
2e54eb96e2
commit
b89f432133
8 changed files with 97 additions and 66 deletions
|
|
@ -33,7 +33,7 @@
|
|||
*/
|
||||
|
||||
#include <linux/file.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/namei.h>
|
||||
#include <linux/swap.h>
|
||||
|
|
@ -3895,7 +3895,7 @@ check_for_locks(struct nfs4_file *filp, struct nfs4_stateowner *lowner)
|
|||
struct inode *inode = filp->fi_inode;
|
||||
int status = 0;
|
||||
|
||||
lock_kernel();
|
||||
lock_flocks();
|
||||
for (flpp = &inode->i_flock; *flpp != NULL; flpp = &(*flpp)->fl_next) {
|
||||
if ((*flpp)->fl_owner == (fl_owner_t)lowner) {
|
||||
status = 1;
|
||||
|
|
@ -3903,7 +3903,7 @@ check_for_locks(struct nfs4_file *filp, struct nfs4_stateowner *lowner)
|
|||
}
|
||||
}
|
||||
out:
|
||||
unlock_kernel();
|
||||
unlock_flocks();
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue