Commit 34287aa3 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David Woodhouse

Btrfs: use unlocked_ioctl

No reason to grab the BKL before calling into the btrfs ioctl code.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 432eba08
...@@ -1219,10 +1219,7 @@ struct inode *btrfs_alloc_inode(struct super_block *sb); ...@@ -1219,10 +1219,7 @@ struct inode *btrfs_alloc_inode(struct super_block *sb);
void btrfs_destroy_inode(struct inode *inode); void btrfs_destroy_inode(struct inode *inode);
int btrfs_init_cachep(void); int btrfs_init_cachep(void);
void btrfs_destroy_cachep(void); void btrfs_destroy_cachep(void);
int btrfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, long btrfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
unsigned long arg);
long btrfs_compat_ioctl(struct file *file, unsigned int cmd,
unsigned long arg);
struct inode *btrfs_iget_locked(struct super_block *s, u64 objectid, struct inode *btrfs_iget_locked(struct super_block *s, u64 objectid,
struct btrfs_root *root); struct btrfs_root *root);
int btrfs_commit_write(struct file *file, struct page *page, int btrfs_commit_write(struct file *file, struct page *page,
......
...@@ -732,10 +732,10 @@ struct file_operations btrfs_file_operations = { ...@@ -732,10 +732,10 @@ struct file_operations btrfs_file_operations = {
.write = btrfs_file_write, .write = btrfs_file_write,
.mmap = btrfs_file_mmap, .mmap = btrfs_file_mmap,
.open = generic_file_open, .open = generic_file_open,
.ioctl = btrfs_ioctl,
.fsync = btrfs_sync_file, .fsync = btrfs_sync_file,
.unlocked_ioctl = btrfs_ioctl,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = btrfs_compat_ioctl, .compat_ioctl = btrfs_ioctl,
#endif #endif
}; };
...@@ -1957,9 +1957,10 @@ int btrfs_defrag_file(struct file *file) { ...@@ -1957,9 +1957,10 @@ int btrfs_defrag_file(struct file *file) {
return 0; return 0;
} }
int btrfs_ioctl(struct inode *inode, struct file *filp, unsigned int long btrfs_ioctl(struct file *file, unsigned int
cmd, unsigned long arg) cmd, unsigned long arg)
{ {
struct inode *inode = file->f_path.dentry->d_inode;
struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_root *root = BTRFS_I(inode)->root;
struct btrfs_ioctl_vol_args vol_args; struct btrfs_ioctl_vol_args vol_args;
int ret = 0; int ret = 0;
...@@ -2007,7 +2008,7 @@ int btrfs_ioctl(struct inode *inode, struct file *filp, unsigned int ...@@ -2007,7 +2008,7 @@ int btrfs_ioctl(struct inode *inode, struct file *filp, unsigned int
btrfs_defrag_root(root->fs_info->extent_root, 0); btrfs_defrag_root(root->fs_info->extent_root, 0);
mutex_unlock(&root->fs_info->fs_mutex); mutex_unlock(&root->fs_info->fs_mutex);
} else if (S_ISREG(inode->i_mode)) { } else if (S_ISREG(inode->i_mode)) {
btrfs_defrag_file(filp); btrfs_defrag_file(file);
} }
ret = 0; ret = 0;
break; break;
...@@ -2017,20 +2018,6 @@ int btrfs_ioctl(struct inode *inode, struct file *filp, unsigned int ...@@ -2017,20 +2018,6 @@ int btrfs_ioctl(struct inode *inode, struct file *filp, unsigned int
return ret; return ret;
} }
#ifdef CONFIG_COMPAT
long btrfs_compat_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
struct inode *inode = file->f_path.dentry->d_inode;
int ret;
lock_kernel();
ret = btrfs_ioctl(inode, file, cmd, (unsigned long) compat_ptr(arg));
unlock_kernel();
return ret;
}
#endif
/* /*
* Called inside transaction, so use GFP_NOFS * Called inside transaction, so use GFP_NOFS
*/ */
...@@ -2341,9 +2328,9 @@ static struct file_operations btrfs_dir_file_operations = { ...@@ -2341,9 +2328,9 @@ static struct file_operations btrfs_dir_file_operations = {
.llseek = generic_file_llseek, .llseek = generic_file_llseek,
.read = generic_read_dir, .read = generic_read_dir,
.readdir = btrfs_readdir, .readdir = btrfs_readdir,
.ioctl = btrfs_ioctl, .unlocked_ioctl = btrfs_ioctl,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = btrfs_compat_ioctl, .compat_ioctl = btrfs_ioctl,
#endif #endif
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment