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.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index f338c5672d58..51e3afa78354 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4688,11 +4688,11 @@ static void inode_tree_add(struct inode *inode)
4688 struct btrfs_inode *entry; 4688 struct btrfs_inode *entry;
4689 struct rb_node **p; 4689 struct rb_node **p;
4690 struct rb_node *parent; 4690 struct rb_node *parent;
4691 struct rb_node *new = &BTRFS_I(inode)->rb_node;
4691 u64 ino = btrfs_ino(inode); 4692 u64 ino = btrfs_ino(inode);
4692 4693
4693 if (inode_unhashed(inode)) 4694 if (inode_unhashed(inode))
4694 return; 4695 return;
4695again:
4696 parent = NULL; 4696 parent = NULL;
4697 spin_lock(&root->inode_lock); 4697 spin_lock(&root->inode_lock);
4698 p = &root->inode_tree.rb_node; 4698 p = &root->inode_tree.rb_node;
@@ -4707,14 +4707,14 @@ again:
4707 else { 4707 else {
4708 WARN_ON(!(entry->vfs_inode.i_state & 4708 WARN_ON(!(entry->vfs_inode.i_state &
4709 (I_WILL_FREE | I_FREEING))); 4709 (I_WILL_FREE | I_FREEING)));
4710 rb_erase(parent, &root->inode_tree); 4710 rb_replace_node(parent, new, &root->inode_tree);
4711 RB_CLEAR_NODE(parent); 4711 RB_CLEAR_NODE(parent);
4712 spin_unlock(&root->inode_lock); 4712 spin_unlock(&root->inode_lock);
4713 goto again; 4713 return;
4714 } 4714 }
4715 } 4715 }
4716 rb_link_node(&BTRFS_I(inode)->rb_node, parent, p); 4716 rb_link_node(new, parent, p);
4717 rb_insert_color(&BTRFS_I(inode)->rb_node, &root->inode_tree); 4717 rb_insert_color(new, &root->inode_tree);
4718 spin_unlock(&root->inode_lock); 4718 spin_unlock(&root->inode_lock);
4719} 4719}
4720 4720
@@ -6437,6 +6437,7 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
6437 6437
6438 if (btrfs_extent_readonly(root, disk_bytenr)) 6438 if (btrfs_extent_readonly(root, disk_bytenr))
6439 goto out; 6439 goto out;
6440 btrfs_release_path(path);
6440 6441
6441 /* 6442 /*
6442 * look for other files referencing this extent, if we 6443 * look for other files referencing this extent, if we
@@ -7986,7 +7987,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
7986 7987
7987 7988
7988 /* check for collisions, even if the name isn't there */ 7989 /* check for collisions, even if the name isn't there */
7989 ret = btrfs_check_dir_item_collision(root, new_dir->i_ino, 7990 ret = btrfs_check_dir_item_collision(dest, new_dir->i_ino,
7990 new_dentry->d_name.name, 7991 new_dentry->d_name.name,
7991 new_dentry->d_name.len); 7992 new_dentry->d_name.len);
7992 7993
@@ -8216,6 +8217,10 @@ static int __start_delalloc_inodes(struct btrfs_root *root, int delay_iput)
8216 8217
8217 work = btrfs_alloc_delalloc_work(inode, 0, delay_iput); 8218 work = btrfs_alloc_delalloc_work(inode, 0, delay_iput);
8218 if (unlikely(!work)) { 8219 if (unlikely(!work)) {
8220 if (delay_iput)
8221 btrfs_add_delayed_iput(inode);
8222 else
8223 iput(inode);
8219 ret = -ENOMEM; 8224 ret = -ENOMEM;
8220 goto out; 8225 goto out;
8221 } 8226 }
@@ -8613,11 +8618,13 @@ static const struct inode_operations btrfs_dir_inode_operations = {
8613 .removexattr = btrfs_removexattr, 8618 .removexattr = btrfs_removexattr,
8614 .permission = btrfs_permission, 8619 .permission = btrfs_permission,
8615 .get_acl = btrfs_get_acl, 8620 .get_acl = btrfs_get_acl,
8621 .update_time = btrfs_update_time,
8616}; 8622};
8617static const struct inode_operations btrfs_dir_ro_inode_operations = { 8623static const struct inode_operations btrfs_dir_ro_inode_operations = {
8618 .lookup = btrfs_lookup, 8624 .lookup = btrfs_lookup,
8619 .permission = btrfs_permission, 8625 .permission = btrfs_permission,
8620 .get_acl = btrfs_get_acl, 8626 .get_acl = btrfs_get_acl,
8627 .update_time = btrfs_update_time,
8621}; 8628};
8622 8629
8623static const struct file_operations btrfs_dir_file_operations = { 8630static const struct file_operations btrfs_dir_file_operations = {