aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2010-09-18 09:09:31 -0400
committerArnd Bergmann <arnd@arndb.de>2010-10-05 05:02:04 -0400
commitb89f432133851a01c0d28822f11cbdcc15781a75 (patch)
treea3e9ba638a9b746985148f4525335d360ec7da56 /include/linux/fs.h
parent2e54eb96e2c801f33d95b5dade15212ac4d6c4a5 (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 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 63d069bd80b7..180325268237 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1093,10 +1093,6 @@ struct file_lock {
1093 1093
1094#include <linux/fcntl.h> 1094#include <linux/fcntl.h>
1095 1095
1096/* temporary stubs for BKL removal */
1097#define lock_flocks() lock_kernel()
1098#define unlock_flocks() unlock_kernel()
1099
1100extern void send_sigio(struct fown_struct *fown, int fd, int band); 1096extern void send_sigio(struct fown_struct *fown, int fd, int band);
1101 1097
1102#ifdef CONFIG_FILE_LOCKING 1098#ifdef CONFIG_FILE_LOCKING
@@ -1135,6 +1131,8 @@ extern int vfs_setlease(struct file *, long, struct file_lock **);
1135extern int lease_modify(struct file_lock **, int); 1131extern int lease_modify(struct file_lock **, int);
1136extern int lock_may_read(struct inode *, loff_t start, unsigned long count); 1132extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
1137extern int lock_may_write(struct inode *, loff_t start, unsigned long count); 1133extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
1134extern void lock_flocks(void);
1135extern void unlock_flocks(void);
1138#else /* !CONFIG_FILE_LOCKING */ 1136#else /* !CONFIG_FILE_LOCKING */
1139static inline int fcntl_getlk(struct file *file, struct flock __user *user) 1137static inline int fcntl_getlk(struct file *file, struct flock __user *user)
1140{ 1138{
@@ -1277,6 +1275,14 @@ static inline int lock_may_write(struct inode *inode, loff_t start,
1277 return 1; 1275 return 1;
1278} 1276}
1279 1277
1278static inline void lock_flocks(void)
1279{
1280}
1281
1282static inline void unlock_flocks(void)
1283{
1284}
1285
1280#endif /* !CONFIG_FILE_LOCKING */ 1286#endif /* !CONFIG_FILE_LOCKING */
1281 1287
1282 1288