aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2007-09-14 10:22:47 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-09-14 10:22:47 -0400
commit34287aa3605d52ef5a4b6e5e2cca98667166508b (patch)
tree9fe98c52d32c2bfe0ee37115b7bafa1dae7f320d
parent432eba0882a32d6181ba44044f6e576226134784 (diff)
Btrfs: use unlocked_ioctl
No reason to grab the BKL before calling into the btrfs ioctl code. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r--fs/btrfs/ctree.h5
-rw-r--r--fs/btrfs/file.c4
-rw-r--r--fs/btrfs/inode.c23
3 files changed, 8 insertions, 24 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 6d6e94b63803..800a3499cc3f 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1219,10 +1219,7 @@ struct inode *btrfs_alloc_inode(struct super_block *sb);
1219void btrfs_destroy_inode(struct inode *inode); 1219void btrfs_destroy_inode(struct inode *inode);
1220int btrfs_init_cachep(void); 1220int btrfs_init_cachep(void);
1221void btrfs_destroy_cachep(void); 1221void btrfs_destroy_cachep(void);
1222int btrfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, 1222long btrfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
1223 unsigned long arg);
1224long btrfs_compat_ioctl(struct file *file, unsigned int cmd,
1225 unsigned long arg);
1226struct inode *btrfs_iget_locked(struct super_block *s, u64 objectid, 1223struct inode *btrfs_iget_locked(struct super_block *s, u64 objectid,
1227 struct btrfs_root *root); 1224 struct btrfs_root *root);
1228int btrfs_commit_write(struct file *file, struct page *page, 1225int btrfs_commit_write(struct file *file, struct page *page,
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index c26ca54ed4de..ca7e5d4474e0 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -732,10 +732,10 @@ struct file_operations btrfs_file_operations = {
732 .write = btrfs_file_write, 732 .write = btrfs_file_write,
733 .mmap = btrfs_file_mmap, 733 .mmap = btrfs_file_mmap,
734 .open = generic_file_open, 734 .open = generic_file_open,
735 .ioctl = btrfs_ioctl,
736 .fsync = btrfs_sync_file, 735 .fsync = btrfs_sync_file,
736 .unlocked_ioctl = btrfs_ioctl,
737#ifdef CONFIG_COMPAT 737#ifdef CONFIG_COMPAT
738 .compat_ioctl = btrfs_compat_ioctl, 738 .compat_ioctl = btrfs_ioctl,
739#endif 739#endif
740}; 740};
741 741
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index cde8ddde6098..3901a7fa0947 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1957,9 +1957,10 @@ out_unlock:
1957 return 0; 1957 return 0;
1958} 1958}
1959 1959
1960int btrfs_ioctl(struct inode *inode, struct file *filp, unsigned int 1960long btrfs_ioctl(struct file *file, unsigned int
1961 cmd, unsigned long arg) 1961 cmd, unsigned long arg)
1962{ 1962{
1963 struct inode *inode = file->f_path.dentry->d_inode;
1963 struct btrfs_root *root = BTRFS_I(inode)->root; 1964 struct btrfs_root *root = BTRFS_I(inode)->root;
1964 struct btrfs_ioctl_vol_args vol_args; 1965 struct btrfs_ioctl_vol_args vol_args;
1965 int ret = 0; 1966 int ret = 0;
@@ -2007,7 +2008,7 @@ int btrfs_ioctl(struct inode *inode, struct file *filp, unsigned int
2007 btrfs_defrag_root(root->fs_info->extent_root, 0); 2008 btrfs_defrag_root(root->fs_info->extent_root, 0);
2008 mutex_unlock(&root->fs_info->fs_mutex); 2009 mutex_unlock(&root->fs_info->fs_mutex);
2009 } else if (S_ISREG(inode->i_mode)) { 2010 } else if (S_ISREG(inode->i_mode)) {
2010 btrfs_defrag_file(filp); 2011 btrfs_defrag_file(file);
2011 } 2012 }
2012 ret = 0; 2013 ret = 0;
2013 break; 2014 break;
@@ -2017,20 +2018,6 @@ int btrfs_ioctl(struct inode *inode, struct file *filp, unsigned int
2017 return ret; 2018 return ret;
2018} 2019}
2019 2020
2020#ifdef CONFIG_COMPAT
2021long btrfs_compat_ioctl(struct file *file, unsigned int cmd,
2022 unsigned long arg)
2023{
2024 struct inode *inode = file->f_path.dentry->d_inode;
2025 int ret;
2026 lock_kernel();
2027 ret = btrfs_ioctl(inode, file, cmd, (unsigned long) compat_ptr(arg));
2028 unlock_kernel();
2029 return ret;
2030
2031}
2032#endif
2033
2034/* 2021/*
2035 * Called inside transaction, so use GFP_NOFS 2022 * Called inside transaction, so use GFP_NOFS
2036 */ 2023 */
@@ -2341,9 +2328,9 @@ static struct file_operations btrfs_dir_file_operations = {
2341 .llseek = generic_file_llseek, 2328 .llseek = generic_file_llseek,
2342 .read = generic_read_dir, 2329 .read = generic_read_dir,
2343 .readdir = btrfs_readdir, 2330 .readdir = btrfs_readdir,
2344 .ioctl = btrfs_ioctl, 2331 .unlocked_ioctl = btrfs_ioctl,
2345#ifdef CONFIG_COMPAT 2332#ifdef CONFIG_COMPAT
2346 .compat_ioctl = btrfs_compat_ioctl, 2333 .compat_ioctl = btrfs_ioctl,
2347#endif 2334#endif
2348}; 2335};
2349 2336