aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 3601f0aebddf..2548a04a0230 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4079,13 +4079,7 @@ static int btrfs_dentry_delete(const struct dentry *dentry)
4079static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry, 4079static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry,
4080 struct nameidata *nd) 4080 struct nameidata *nd)
4081{ 4081{
4082 struct inode *inode; 4082 return d_splice_alias(btrfs_lookup_dentry(dir, dentry), dentry);
4083
4084 inode = btrfs_lookup_dentry(dir, dentry);
4085 if (IS_ERR(inode))
4086 return ERR_CAST(inode);
4087
4088 return d_splice_alias(inode, dentry);
4089} 4083}
4090 4084
4091unsigned char btrfs_filetype_table[] = { 4085unsigned char btrfs_filetype_table[] = {
@@ -4772,11 +4766,10 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
4772 if (err) { 4766 if (err) {
4773 drop_inode = 1; 4767 drop_inode = 1;
4774 } else { 4768 } else {
4775 struct dentry *parent = dget_parent(dentry); 4769 struct dentry *parent = dentry->d_parent;
4776 err = btrfs_update_inode(trans, root, inode); 4770 err = btrfs_update_inode(trans, root, inode);
4777 BUG_ON(err); 4771 BUG_ON(err);
4778 btrfs_log_new_name(trans, inode, NULL, parent); 4772 btrfs_log_new_name(trans, inode, NULL, parent);
4779 dput(parent);
4780 } 4773 }
4781 4774
4782 nr = trans->blocks_used; 4775 nr = trans->blocks_used;
@@ -6900,7 +6893,7 @@ static int btrfs_getattr(struct vfsmount *mnt,
6900{ 6893{
6901 struct inode *inode = dentry->d_inode; 6894 struct inode *inode = dentry->d_inode;
6902 generic_fillattr(inode, stat); 6895 generic_fillattr(inode, stat);
6903 stat->dev = BTRFS_I(inode)->root->anon_super.s_dev; 6896 stat->dev = BTRFS_I(inode)->root->anon_dev;
6904 stat->blksize = PAGE_CACHE_SIZE; 6897 stat->blksize = PAGE_CACHE_SIZE;
6905 stat->blocks = (inode_get_bytes(inode) + 6898 stat->blocks = (inode_get_bytes(inode) +
6906 BTRFS_I(inode)->delalloc_bytes) >> 9; 6899 BTRFS_I(inode)->delalloc_bytes) >> 9;
@@ -7068,9 +7061,8 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
7068 BUG_ON(ret); 7061 BUG_ON(ret);
7069 7062
7070 if (old_ino != BTRFS_FIRST_FREE_OBJECTID) { 7063 if (old_ino != BTRFS_FIRST_FREE_OBJECTID) {
7071 struct dentry *parent = dget_parent(new_dentry); 7064 struct dentry *parent = new_dentry->d_parent;
7072 btrfs_log_new_name(trans, old_inode, old_dir, parent); 7065 btrfs_log_new_name(trans, old_inode, old_dir, parent);
7073 dput(parent);
7074 btrfs_end_log_trans(root); 7066 btrfs_end_log_trans(root);
7075 } 7067 }
7076out_fail: 7068out_fail:
@@ -7331,7 +7323,7 @@ static int btrfs_set_page_dirty(struct page *page)
7331 return __set_page_dirty_nobuffers(page); 7323 return __set_page_dirty_nobuffers(page);
7332} 7324}
7333 7325
7334static int btrfs_permission(struct inode *inode, int mask, unsigned int flags) 7326static int btrfs_permission(struct inode *inode, int mask)
7335{ 7327{
7336 struct btrfs_root *root = BTRFS_I(inode)->root; 7328 struct btrfs_root *root = BTRFS_I(inode)->root;
7337 7329
@@ -7339,7 +7331,7 @@ static int btrfs_permission(struct inode *inode, int mask, unsigned int flags)
7339 return -EROFS; 7331 return -EROFS;
7340 if ((BTRFS_I(inode)->flags & BTRFS_INODE_READONLY) && (mask & MAY_WRITE)) 7332 if ((BTRFS_I(inode)->flags & BTRFS_INODE_READONLY) && (mask & MAY_WRITE))
7341 return -EACCES; 7333 return -EACCES;
7342 return generic_permission(inode, mask, flags, btrfs_check_acl); 7334 return generic_permission(inode, mask);
7343} 7335}
7344 7336
7345static const struct inode_operations btrfs_dir_inode_operations = { 7337static const struct inode_operations btrfs_dir_inode_operations = {
@@ -7359,10 +7351,12 @@ static const struct inode_operations btrfs_dir_inode_operations = {
7359 .listxattr = btrfs_listxattr, 7351 .listxattr = btrfs_listxattr,
7360 .removexattr = btrfs_removexattr, 7352 .removexattr = btrfs_removexattr,
7361 .permission = btrfs_permission, 7353 .permission = btrfs_permission,
7354 .check_acl = btrfs_check_acl,
7362}; 7355};
7363static const struct inode_operations btrfs_dir_ro_inode_operations = { 7356static const struct inode_operations btrfs_dir_ro_inode_operations = {
7364 .lookup = btrfs_lookup, 7357 .lookup = btrfs_lookup,
7365 .permission = btrfs_permission, 7358 .permission = btrfs_permission,
7359 .check_acl = btrfs_check_acl,
7366}; 7360};
7367 7361
7368static const struct file_operations btrfs_dir_file_operations = { 7362static const struct file_operations btrfs_dir_file_operations = {
@@ -7431,6 +7425,7 @@ static const struct inode_operations btrfs_file_inode_operations = {
7431 .removexattr = btrfs_removexattr, 7425 .removexattr = btrfs_removexattr,
7432 .permission = btrfs_permission, 7426 .permission = btrfs_permission,
7433 .fiemap = btrfs_fiemap, 7427 .fiemap = btrfs_fiemap,
7428 .check_acl = btrfs_check_acl,
7434}; 7429};
7435static const struct inode_operations btrfs_special_inode_operations = { 7430static const struct inode_operations btrfs_special_inode_operations = {
7436 .getattr = btrfs_getattr, 7431 .getattr = btrfs_getattr,
@@ -7440,6 +7435,7 @@ static const struct inode_operations btrfs_special_inode_operations = {
7440 .getxattr = btrfs_getxattr, 7435 .getxattr = btrfs_getxattr,
7441 .listxattr = btrfs_listxattr, 7436 .listxattr = btrfs_listxattr,
7442 .removexattr = btrfs_removexattr, 7437 .removexattr = btrfs_removexattr,
7438 .check_acl = btrfs_check_acl,
7443}; 7439};
7444static const struct inode_operations btrfs_symlink_inode_operations = { 7440static const struct inode_operations btrfs_symlink_inode_operations = {
7445 .readlink = generic_readlink, 7441 .readlink = generic_readlink,
@@ -7451,6 +7447,7 @@ static const struct inode_operations btrfs_symlink_inode_operations = {
7451 .getxattr = btrfs_getxattr, 7447 .getxattr = btrfs_getxattr,
7452 .listxattr = btrfs_listxattr, 7448 .listxattr = btrfs_listxattr,
7453 .removexattr = btrfs_removexattr, 7449 .removexattr = btrfs_removexattr,
7450 .check_acl = btrfs_check_acl,
7454}; 7451};
7455 7452
7456const struct dentry_operations btrfs_dentry_operations = { 7453const struct dentry_operations btrfs_dentry_operations = {