diff options
author | Arnd Bergmann <arnd@arndb.de> | 2010-09-18 09:09:31 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2010-10-05 05:02:04 -0400 |
commit | b89f432133851a01c0d28822f11cbdcc15781a75 (patch) | |
tree | a3e9ba638a9b746985148f4525335d360ec7da56 /fs/afs/flock.c | |
parent | 2e54eb96e2c801f33d95b5dade15212ac4d6c4a5 (diff) |
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 <arnd@arndb.de>
Acked-by: Matthew Wilcox <willy@linux.intel.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Miklos Szeredi <mszeredi@suse.cz>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
Cc: Sage Weil <sage@newdream.net>
Cc: linux-kernel@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org
Diffstat (limited to 'fs/afs/flock.c')
-rw-r--r-- | fs/afs/flock.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/afs/flock.c b/fs/afs/flock.c index 0931bc1325eb..757d664575dd 100644 --- a/fs/afs/flock.c +++ b/fs/afs/flock.c | |||
@@ -9,7 +9,6 @@ | |||
9 | * 2 of the License, or (at your option) any later version. | 9 | * 2 of the License, or (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/smp_lock.h> | ||
13 | #include "internal.h" | 12 | #include "internal.h" |
14 | 13 | ||
15 | #define AFS_LOCK_GRANTED 0 | 14 | #define AFS_LOCK_GRANTED 0 |
@@ -274,7 +273,7 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl) | |||
274 | 273 | ||
275 | type = (fl->fl_type == F_RDLCK) ? AFS_LOCK_READ : AFS_LOCK_WRITE; | 274 | type = (fl->fl_type == F_RDLCK) ? AFS_LOCK_READ : AFS_LOCK_WRITE; |
276 | 275 | ||
277 | lock_kernel(); | 276 | lock_flocks(); |
278 | 277 | ||
279 | /* make sure we've got a callback on this file and that our view of the | 278 | /* make sure we've got a callback on this file and that our view of the |
280 | * data version is up to date */ | 279 | * data version is up to date */ |
@@ -421,7 +420,7 @@ given_lock: | |||
421 | afs_vnode_fetch_status(vnode, NULL, key); | 420 | afs_vnode_fetch_status(vnode, NULL, key); |
422 | 421 | ||
423 | error: | 422 | error: |
424 | unlock_kernel(); | 423 | unlock_flocks(); |
425 | _leave(" = %d", ret); | 424 | _leave(" = %d", ret); |
426 | return ret; | 425 | return ret; |
427 | 426 | ||