get rid of BKL in fs/efs

Only readdir() really needed it, and that's easily fixable by switch to
generic_file_llseek()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2009-06-16 23:35:46 -04:00
parent 536c94901e
commit e7ec952f6a
3 changed files with 3 additions and 18 deletions

View File

@ -5,12 +5,12 @@
*/ */
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/smp_lock.h>
#include "efs.h" #include "efs.h"
static int efs_readdir(struct file *, void *, filldir_t); static int efs_readdir(struct file *, void *, filldir_t);
const struct file_operations efs_dir_operations = { const struct file_operations efs_dir_operations = {
.llseek = generic_file_llseek,
.read = generic_read_dir, .read = generic_read_dir,
.readdir = efs_readdir, .readdir = efs_readdir,
}; };
@ -33,8 +33,6 @@ static int efs_readdir(struct file *filp, void *dirent, filldir_t filldir) {
if (inode->i_size & (EFS_DIRBSIZE-1)) if (inode->i_size & (EFS_DIRBSIZE-1))
printk(KERN_WARNING "EFS: WARNING: readdir(): directory size not a multiple of EFS_DIRBSIZE\n"); printk(KERN_WARNING "EFS: WARNING: readdir(): directory size not a multiple of EFS_DIRBSIZE\n");
lock_kernel();
/* work out where this entry can be found */ /* work out where this entry can be found */
block = filp->f_pos >> EFS_DIRBSIZE_BITS; block = filp->f_pos >> EFS_DIRBSIZE_BITS;
@ -107,7 +105,6 @@ static int efs_readdir(struct file *filp, void *dirent, filldir_t filldir) {
filp->f_pos = (block << EFS_DIRBSIZE_BITS) | slot; filp->f_pos = (block << EFS_DIRBSIZE_BITS) | slot;
out: out:
unlock_kernel();
return 0; return 0;
} }

View File

@ -8,7 +8,6 @@
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/smp_lock.h>
#include <linux/exportfs.h> #include <linux/exportfs.h>
#include "efs.h" #include "efs.h"
@ -63,16 +62,12 @@ struct dentry *efs_lookup(struct inode *dir, struct dentry *dentry, struct namei
efs_ino_t inodenum; efs_ino_t inodenum;
struct inode * inode = NULL; struct inode * inode = NULL;
lock_kernel();
inodenum = efs_find_entry(dir, dentry->d_name.name, dentry->d_name.len); inodenum = efs_find_entry(dir, dentry->d_name.name, dentry->d_name.len);
if (inodenum) { if (inodenum) {
inode = efs_iget(dir->i_sb, inodenum); inode = efs_iget(dir->i_sb, inodenum);
if (IS_ERR(inode)) { if (IS_ERR(inode))
unlock_kernel();
return ERR_CAST(inode); return ERR_CAST(inode);
}
} }
unlock_kernel();
return d_splice_alias(inode, dentry); return d_splice_alias(inode, dentry);
} }
@ -115,11 +110,9 @@ struct dentry *efs_get_parent(struct dentry *child)
struct dentry *parent = ERR_PTR(-ENOENT); struct dentry *parent = ERR_PTR(-ENOENT);
efs_ino_t ino; efs_ino_t ino;
lock_kernel();
ino = efs_find_entry(child->d_inode, "..", 2); ino = efs_find_entry(child->d_inode, "..", 2);
if (ino) if (ino)
parent = d_obtain_alias(efs_iget(child->d_inode->i_sb, ino)); parent = d_obtain_alias(efs_iget(child->d_inode->i_sb, ino));
unlock_kernel();
return parent; return parent;
} }

View File

@ -9,7 +9,6 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/smp_lock.h>
#include "efs.h" #include "efs.h"
static int efs_symlink_readpage(struct file *file, struct page *page) static int efs_symlink_readpage(struct file *file, struct page *page)
@ -22,9 +21,8 @@ static int efs_symlink_readpage(struct file *file, struct page *page)
err = -ENAMETOOLONG; err = -ENAMETOOLONG;
if (size > 2 * EFS_BLOCKSIZE) if (size > 2 * EFS_BLOCKSIZE)
goto fail_notlocked; goto fail;
lock_kernel();
/* read first 512 bytes of link target */ /* read first 512 bytes of link target */
err = -EIO; err = -EIO;
bh = sb_bread(inode->i_sb, efs_bmap(inode, 0)); bh = sb_bread(inode->i_sb, efs_bmap(inode, 0));
@ -40,14 +38,11 @@ static int efs_symlink_readpage(struct file *file, struct page *page)
brelse(bh); brelse(bh);
} }
link[size] = '\0'; link[size] = '\0';
unlock_kernel();
SetPageUptodate(page); SetPageUptodate(page);
kunmap(page); kunmap(page);
unlock_page(page); unlock_page(page);
return 0; return 0;
fail: fail:
unlock_kernel();
fail_notlocked:
SetPageError(page); SetPageError(page);
kunmap(page); kunmap(page);
unlock_page(page); unlock_page(page);