diff options
author | Jeff Layton <jlayton@primarydata.com> | 2014-08-22 10:18:44 -0400 |
---|---|---|
committer | Jeff Layton <jlayton@primarydata.com> | 2014-09-09 16:01:09 -0400 |
commit | 699688a416524c3cea9eafaca69fc6c06c13c02e (patch) | |
tree | 3ece46a475ab54135bbcd01d97a563c52a1f2eaa /fs/locks.c | |
parent | 09802fd2a8caea2a2147fca8d7975697c5de573d (diff) | |
download | linux-stable-699688a416524c3cea9eafaca69fc6c06c13c02e.tar.gz linux-stable-699688a416524c3cea9eafaca69fc6c06c13c02e.tar.bz2 linux-stable-699688a416524c3cea9eafaca69fc6c06c13c02e.zip |
locks: remove lock_may_read and lock_may_write
There are no callers of these functions.
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Diffstat (limited to 'fs/locks.c')
-rw-r--r-- | fs/locks.c | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/fs/locks.c b/fs/locks.c index c3991dc80137..5200ffd2ba9b 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -2597,86 +2597,6 @@ static int __init proc_locks_init(void) module_init(proc_locks_init); #endif -/** - * lock_may_read - checks that the region is free of locks - * @inode: the inode that is being read - * @start: the first byte to read - * @len: the number of bytes to read - * - * Emulates Windows locking requirements. Whole-file - * mandatory locks (share modes) can prohibit a read and - * byte-range POSIX locks can prohibit a read if they overlap. - * - * N.B. this function is only ever called - * from knfsd and ownership of locks is never checked. - */ -int lock_may_read(struct inode *inode, loff_t start, unsigned long len) -{ - struct file_lock *fl; - int result = 1; - - spin_lock(&inode->i_lock); - for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) { - if (IS_POSIX(fl)) { - if (fl->fl_type == F_RDLCK) - continue; - if ((fl->fl_end < start) || (fl->fl_start > (start + len))) - continue; - } else if (IS_FLOCK(fl)) { - if (!(fl->fl_type & LOCK_MAND)) - continue; - if (fl->fl_type & LOCK_READ) - continue; - } else - continue; - result = 0; - break; - } - spin_unlock(&inode->i_lock); - return result; -} - -EXPORT_SYMBOL(lock_may_read); - -/** - * lock_may_write - checks that the region is free of locks - * @inode: the inode that is being written - * @start: the first byte to write - * @len: the number of bytes to write - * - * Emulates Windows locking requirements. Whole-file - * mandatory locks (share modes) can prohibit a write and - * byte-range POSIX locks can prohibit a write if they overlap. - * - * N.B. this function is only ever called - * from knfsd and ownership of locks is never checked. - */ -int lock_may_write(struct inode *inode, loff_t start, unsigned long len) -{ - struct file_lock *fl; - int result = 1; - - spin_lock(&inode->i_lock); - for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) { - if (IS_POSIX(fl)) { - if ((fl->fl_end < start) || (fl->fl_start > (start + len))) - continue; - } else if (IS_FLOCK(fl)) { - if (!(fl->fl_type & LOCK_MAND)) - continue; - if (fl->fl_type & LOCK_WRITE) - continue; - } else - continue; - result = 0; - break; - } - spin_unlock(&inode->i_lock); - return result; -} - -EXPORT_SYMBOL(lock_may_write); - static int __init filelock_init(void) { int i; |