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.c87
1 files changed, 9 insertions, 78 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index bc12ba23db5f..dd5938a7de21 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -136,7 +136,6 @@ static noinline int insert_inline_extent(struct btrfs_trans_handle *trans,
136 return -ENOMEM; 136 return -ENOMEM;
137 137
138 path->leave_spinning = 1; 138 path->leave_spinning = 1;
139 btrfs_set_trans_block_group(trans, inode);
140 139
141 key.objectid = inode->i_ino; 140 key.objectid = inode->i_ino;
142 key.offset = start; 141 key.offset = start;
@@ -422,7 +421,6 @@ again:
422 if (start == 0) { 421 if (start == 0) {
423 trans = btrfs_join_transaction(root); 422 trans = btrfs_join_transaction(root);
424 BUG_ON(IS_ERR(trans)); 423 BUG_ON(IS_ERR(trans));
425 btrfs_set_trans_block_group(trans, inode);
426 trans->block_rsv = &root->fs_info->delalloc_block_rsv; 424 trans->block_rsv = &root->fs_info->delalloc_block_rsv;
427 425
428 /* lets try to make an inline extent */ 426 /* lets try to make an inline extent */
@@ -781,7 +779,6 @@ static noinline int cow_file_range(struct inode *inode,
781 BUG_ON(root == root->fs_info->tree_root); 779 BUG_ON(root == root->fs_info->tree_root);
782 trans = btrfs_join_transaction(root); 780 trans = btrfs_join_transaction(root);
783 BUG_ON(IS_ERR(trans)); 781 BUG_ON(IS_ERR(trans));
784 btrfs_set_trans_block_group(trans, inode);
785 trans->block_rsv = &root->fs_info->delalloc_block_rsv; 782 trans->block_rsv = &root->fs_info->delalloc_block_rsv;
786 783
787 num_bytes = (end - start + blocksize) & ~(blocksize - 1); 784 num_bytes = (end - start + blocksize) & ~(blocksize - 1);
@@ -1502,8 +1499,6 @@ static noinline int add_pending_csums(struct btrfs_trans_handle *trans,
1502{ 1499{
1503 struct btrfs_ordered_sum *sum; 1500 struct btrfs_ordered_sum *sum;
1504 1501
1505 btrfs_set_trans_block_group(trans, inode);
1506
1507 list_for_each_entry(sum, list, list) { 1502 list_for_each_entry(sum, list, list) {
1508 btrfs_csum_file_blocks(trans, 1503 btrfs_csum_file_blocks(trans,
1509 BTRFS_I(inode)->root->fs_info->csum_root, sum); 1504 BTRFS_I(inode)->root->fs_info->csum_root, sum);
@@ -1722,7 +1717,6 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end)
1722 else 1717 else
1723 trans = btrfs_join_transaction(root); 1718 trans = btrfs_join_transaction(root);
1724 BUG_ON(IS_ERR(trans)); 1719 BUG_ON(IS_ERR(trans));
1725 btrfs_set_trans_block_group(trans, inode);
1726 trans->block_rsv = &root->fs_info->delalloc_block_rsv; 1720 trans->block_rsv = &root->fs_info->delalloc_block_rsv;
1727 ret = btrfs_update_inode(trans, root, inode); 1721 ret = btrfs_update_inode(trans, root, inode);
1728 BUG_ON(ret); 1722 BUG_ON(ret);
@@ -1739,7 +1733,6 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end)
1739 else 1733 else
1740 trans = btrfs_join_transaction(root); 1734 trans = btrfs_join_transaction(root);
1741 BUG_ON(IS_ERR(trans)); 1735 BUG_ON(IS_ERR(trans));
1742 btrfs_set_trans_block_group(trans, inode);
1743 trans->block_rsv = &root->fs_info->delalloc_block_rsv; 1736 trans->block_rsv = &root->fs_info->delalloc_block_rsv;
1744 1737
1745 if (test_bit(BTRFS_ORDERED_COMPRESSED, &ordered_extent->flags)) 1738 if (test_bit(BTRFS_ORDERED_COMPRESSED, &ordered_extent->flags))
@@ -2495,7 +2488,6 @@ static void btrfs_read_locked_inode(struct inode *inode)
2495 struct btrfs_root *root = BTRFS_I(inode)->root; 2488 struct btrfs_root *root = BTRFS_I(inode)->root;
2496 struct btrfs_key location; 2489 struct btrfs_key location;
2497 int maybe_acls; 2490 int maybe_acls;
2498 u64 alloc_group_block;
2499 u32 rdev; 2491 u32 rdev;
2500 int ret; 2492 int ret;
2501 2493
@@ -2539,8 +2531,6 @@ static void btrfs_read_locked_inode(struct inode *inode)
2539 BTRFS_I(inode)->index_cnt = (u64)-1; 2531 BTRFS_I(inode)->index_cnt = (u64)-1;
2540 BTRFS_I(inode)->flags = btrfs_inode_flags(leaf, inode_item); 2532 BTRFS_I(inode)->flags = btrfs_inode_flags(leaf, inode_item);
2541 2533
2542 alloc_group_block = btrfs_inode_block_group(leaf, inode_item);
2543
2544 /* 2534 /*
2545 * try to precache a NULL acl entry for files that don't have 2535 * try to precache a NULL acl entry for files that don't have
2546 * any xattrs or acls 2536 * any xattrs or acls
@@ -2549,8 +2539,6 @@ static void btrfs_read_locked_inode(struct inode *inode)
2549 if (!maybe_acls) 2539 if (!maybe_acls)
2550 cache_no_acl(inode); 2540 cache_no_acl(inode);
2551 2541
2552 BTRFS_I(inode)->block_group = btrfs_find_block_group(root, 0,
2553 alloc_group_block, 0);
2554 btrfs_free_path(path); 2542 btrfs_free_path(path);
2555 inode_item = NULL; 2543 inode_item = NULL;
2556 2544
@@ -2630,7 +2618,7 @@ static void fill_inode_item(struct btrfs_trans_handle *trans,
2630 btrfs_set_inode_transid(leaf, item, trans->transid); 2618 btrfs_set_inode_transid(leaf, item, trans->transid);
2631 btrfs_set_inode_rdev(leaf, item, inode->i_rdev); 2619 btrfs_set_inode_rdev(leaf, item, inode->i_rdev);
2632 btrfs_set_inode_flags(leaf, item, BTRFS_I(inode)->flags); 2620 btrfs_set_inode_flags(leaf, item, BTRFS_I(inode)->flags);
2633 btrfs_set_inode_block_group(leaf, item, BTRFS_I(inode)->block_group); 2621 btrfs_set_inode_block_group(leaf, item, 0);
2634 2622
2635 if (leaf->map_token) { 2623 if (leaf->map_token) {
2636 unmap_extent_buffer(leaf, leaf->map_token, KM_USER1); 2624 unmap_extent_buffer(leaf, leaf->map_token, KM_USER1);
@@ -2971,8 +2959,6 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry)
2971 if (IS_ERR(trans)) 2959 if (IS_ERR(trans))
2972 return PTR_ERR(trans); 2960 return PTR_ERR(trans);
2973 2961
2974 btrfs_set_trans_block_group(trans, dir);
2975
2976 btrfs_record_unlink_dir(trans, dir, dentry->d_inode, 0); 2962 btrfs_record_unlink_dir(trans, dir, dentry->d_inode, 0);
2977 2963
2978 ret = btrfs_unlink_inode(trans, root, dir, dentry->d_inode, 2964 ret = btrfs_unlink_inode(trans, root, dir, dentry->d_inode,
@@ -3068,8 +3054,6 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)
3068 if (IS_ERR(trans)) 3054 if (IS_ERR(trans))
3069 return PTR_ERR(trans); 3055 return PTR_ERR(trans);
3070 3056
3071 btrfs_set_trans_block_group(trans, dir);
3072
3073 if (unlikely(inode->i_ino == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) { 3057 if (unlikely(inode->i_ino == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) {
3074 err = btrfs_unlink_subvol(trans, root, dir, 3058 err = btrfs_unlink_subvol(trans, root, dir,
3075 BTRFS_I(inode)->location.objectid, 3059 BTRFS_I(inode)->location.objectid,
@@ -3649,7 +3633,6 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size)
3649 err = PTR_ERR(trans); 3633 err = PTR_ERR(trans);
3650 break; 3634 break;
3651 } 3635 }
3652 btrfs_set_trans_block_group(trans, inode);
3653 3636
3654 err = btrfs_drop_extents(trans, inode, cur_offset, 3637 err = btrfs_drop_extents(trans, inode, cur_offset,
3655 cur_offset + hole_size, 3638 cur_offset + hole_size,
@@ -3785,7 +3768,6 @@ void btrfs_evict_inode(struct inode *inode)
3785 while (1) { 3768 while (1) {
3786 trans = btrfs_start_transaction(root, 0); 3769 trans = btrfs_start_transaction(root, 0);
3787 BUG_ON(IS_ERR(trans)); 3770 BUG_ON(IS_ERR(trans));
3788 btrfs_set_trans_block_group(trans, inode);
3789 trans->block_rsv = root->orphan_block_rsv; 3771 trans->block_rsv = root->orphan_block_rsv;
3790 3772
3791 ret = btrfs_block_rsv_check(trans, root, 3773 ret = btrfs_block_rsv_check(trans, root,
@@ -4383,7 +4365,6 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc)
4383 trans = btrfs_join_transaction(root); 4365 trans = btrfs_join_transaction(root);
4384 if (IS_ERR(trans)) 4366 if (IS_ERR(trans))
4385 return PTR_ERR(trans); 4367 return PTR_ERR(trans);
4386 btrfs_set_trans_block_group(trans, inode);
4387 if (nolock) 4368 if (nolock)
4388 ret = btrfs_end_transaction_nolock(trans, root); 4369 ret = btrfs_end_transaction_nolock(trans, root);
4389 else 4370 else
@@ -4409,7 +4390,6 @@ void btrfs_dirty_inode(struct inode *inode)
4409 4390
4410 trans = btrfs_join_transaction(root); 4391 trans = btrfs_join_transaction(root);
4411 BUG_ON(IS_ERR(trans)); 4392 BUG_ON(IS_ERR(trans));
4412 btrfs_set_trans_block_group(trans, inode);
4413 4393
4414 ret = btrfs_update_inode(trans, root, inode); 4394 ret = btrfs_update_inode(trans, root, inode);
4415 if (ret && ret == -ENOSPC) { 4395 if (ret && ret == -ENOSPC) {
@@ -4424,7 +4404,6 @@ void btrfs_dirty_inode(struct inode *inode)
4424 } 4404 }
4425 return; 4405 return;
4426 } 4406 }
4427 btrfs_set_trans_block_group(trans, inode);
4428 4407
4429 ret = btrfs_update_inode(trans, root, inode); 4408 ret = btrfs_update_inode(trans, root, inode);
4430 if (ret) { 4409 if (ret) {
@@ -4519,8 +4498,8 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
4519 struct btrfs_root *root, 4498 struct btrfs_root *root,
4520 struct inode *dir, 4499 struct inode *dir,
4521 const char *name, int name_len, 4500 const char *name, int name_len,
4522 u64 ref_objectid, u64 objectid, 4501 u64 ref_objectid, u64 objectid, int mode,
4523 u64 alloc_hint, int mode, u64 *index) 4502 u64 *index)
4524{ 4503{
4525 struct inode *inode; 4504 struct inode *inode;
4526 struct btrfs_inode_item *inode_item; 4505 struct btrfs_inode_item *inode_item;
@@ -4567,8 +4546,6 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
4567 owner = 0; 4546 owner = 0;
4568 else 4547 else
4569 owner = 1; 4548 owner = 1;
4570 BTRFS_I(inode)->block_group =
4571 btrfs_find_block_group(root, 0, alloc_hint, owner);
4572 4549
4573 key[0].objectid = objectid; 4550 key[0].objectid = objectid;
4574 btrfs_set_key_type(&key[0], BTRFS_INODE_ITEM_KEY); 4551 btrfs_set_key_type(&key[0], BTRFS_INODE_ITEM_KEY);
@@ -4729,11 +4706,9 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry,
4729 if (IS_ERR(trans)) 4706 if (IS_ERR(trans))
4730 return PTR_ERR(trans); 4707 return PTR_ERR(trans);
4731 4708
4732 btrfs_set_trans_block_group(trans, dir);
4733
4734 inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name, 4709 inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name,
4735 dentry->d_name.len, dir->i_ino, objectid, 4710 dentry->d_name.len, dir->i_ino, objectid,
4736 BTRFS_I(dir)->block_group, mode, &index); 4711 mode, &index);
4737 if (IS_ERR(inode)) { 4712 if (IS_ERR(inode)) {
4738 err = PTR_ERR(inode); 4713 err = PTR_ERR(inode);
4739 goto out_unlock; 4714 goto out_unlock;
@@ -4745,7 +4720,6 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry,
4745 goto out_unlock; 4720 goto out_unlock;
4746 } 4721 }
4747 4722
4748 btrfs_set_trans_block_group(trans, inode);
4749 err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); 4723 err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index);
4750 if (err) 4724 if (err)
4751 drop_inode = 1; 4725 drop_inode = 1;
@@ -4754,8 +4728,6 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry,
4754 init_special_inode(inode, inode->i_mode, rdev); 4728 init_special_inode(inode, inode->i_mode, rdev);
4755 btrfs_update_inode(trans, root, inode); 4729 btrfs_update_inode(trans, root, inode);
4756 } 4730 }
4757 btrfs_update_inode_block_group(trans, inode);
4758 btrfs_update_inode_block_group(trans, dir);
4759out_unlock: 4731out_unlock:
4760 nr = trans->blocks_used; 4732 nr = trans->blocks_used;
4761 btrfs_end_transaction_throttle(trans, root); 4733 btrfs_end_transaction_throttle(trans, root);
@@ -4791,11 +4763,9 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
4791 if (IS_ERR(trans)) 4763 if (IS_ERR(trans))
4792 return PTR_ERR(trans); 4764 return PTR_ERR(trans);
4793 4765
4794 btrfs_set_trans_block_group(trans, dir);
4795
4796 inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name, 4766 inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name,
4797 dentry->d_name.len, dir->i_ino, objectid, 4767 dentry->d_name.len, dir->i_ino, objectid,
4798 BTRFS_I(dir)->block_group, mode, &index); 4768 mode, &index);
4799 if (IS_ERR(inode)) { 4769 if (IS_ERR(inode)) {
4800 err = PTR_ERR(inode); 4770 err = PTR_ERR(inode);
4801 goto out_unlock; 4771 goto out_unlock;
@@ -4807,7 +4777,6 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
4807 goto out_unlock; 4777 goto out_unlock;
4808 } 4778 }
4809 4779
4810 btrfs_set_trans_block_group(trans, inode);
4811 err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); 4780 err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index);
4812 if (err) 4781 if (err)
4813 drop_inode = 1; 4782 drop_inode = 1;
@@ -4818,8 +4787,6 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
4818 inode->i_op = &btrfs_file_inode_operations; 4787 inode->i_op = &btrfs_file_inode_operations;
4819 BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; 4788 BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops;
4820 } 4789 }
4821 btrfs_update_inode_block_group(trans, inode);
4822 btrfs_update_inode_block_group(trans, dir);
4823out_unlock: 4790out_unlock:
4824 nr = trans->blocks_used; 4791 nr = trans->blocks_used;
4825 btrfs_end_transaction_throttle(trans, root); 4792 btrfs_end_transaction_throttle(trans, root);
@@ -4866,8 +4833,6 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
4866 4833
4867 btrfs_inc_nlink(inode); 4834 btrfs_inc_nlink(inode);
4868 inode->i_ctime = CURRENT_TIME; 4835 inode->i_ctime = CURRENT_TIME;
4869
4870 btrfs_set_trans_block_group(trans, dir);
4871 ihold(inode); 4836 ihold(inode);
4872 4837
4873 err = btrfs_add_nondir(trans, dir, dentry, inode, 1, index); 4838 err = btrfs_add_nondir(trans, dir, dentry, inode, 1, index);
@@ -4876,7 +4841,6 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
4876 drop_inode = 1; 4841 drop_inode = 1;
4877 } else { 4842 } else {
4878 struct dentry *parent = dget_parent(dentry); 4843 struct dentry *parent = dget_parent(dentry);
4879 btrfs_update_inode_block_group(trans, dir);
4880 err = btrfs_update_inode(trans, root, inode); 4844 err = btrfs_update_inode(trans, root, inode);
4881 BUG_ON(err); 4845 BUG_ON(err);
4882 btrfs_log_new_name(trans, inode, NULL, parent); 4846 btrfs_log_new_name(trans, inode, NULL, parent);
@@ -4917,12 +4881,10 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
4917 trans = btrfs_start_transaction(root, 5); 4881 trans = btrfs_start_transaction(root, 5);
4918 if (IS_ERR(trans)) 4882 if (IS_ERR(trans))
4919 return PTR_ERR(trans); 4883 return PTR_ERR(trans);
4920 btrfs_set_trans_block_group(trans, dir);
4921 4884
4922 inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name, 4885 inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name,
4923 dentry->d_name.len, dir->i_ino, objectid, 4886 dentry->d_name.len, dir->i_ino, objectid,
4924 BTRFS_I(dir)->block_group, S_IFDIR | mode, 4887 S_IFDIR | mode, &index);
4925 &index);
4926 if (IS_ERR(inode)) { 4888 if (IS_ERR(inode)) {
4927 err = PTR_ERR(inode); 4889 err = PTR_ERR(inode);
4928 goto out_fail; 4890 goto out_fail;
@@ -4936,7 +4898,6 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
4936 4898
4937 inode->i_op = &btrfs_dir_inode_operations; 4899 inode->i_op = &btrfs_dir_inode_operations;
4938 inode->i_fop = &btrfs_dir_file_operations; 4900 inode->i_fop = &btrfs_dir_file_operations;
4939 btrfs_set_trans_block_group(trans, inode);
4940 4901
4941 btrfs_i_size_write(inode, 0); 4902 btrfs_i_size_write(inode, 0);
4942 err = btrfs_update_inode(trans, root, inode); 4903 err = btrfs_update_inode(trans, root, inode);
@@ -4950,8 +4911,6 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
4950 4911
4951 d_instantiate(dentry, inode); 4912 d_instantiate(dentry, inode);
4952 drop_on_err = 0; 4913 drop_on_err = 0;
4953 btrfs_update_inode_block_group(trans, inode);
4954 btrfs_update_inode_block_group(trans, dir);
4955 4914
4956out_fail: 4915out_fail:
4957 nr = trans->blocks_used; 4916 nr = trans->blocks_used;
@@ -6652,8 +6611,6 @@ static int btrfs_truncate(struct inode *inode)
6652 goto out; 6611 goto out;
6653 } 6612 }
6654 6613
6655 btrfs_set_trans_block_group(trans, inode);
6656
6657 /* 6614 /*
6658 * Reserve space for the truncate process. Truncate should be adding 6615 * Reserve space for the truncate process. Truncate should be adding
6659 * space, but if there are snapshots it may end up using space. 6616 * space, but if there are snapshots it may end up using space.
@@ -6680,7 +6637,6 @@ static int btrfs_truncate(struct inode *inode)
6680 err = PTR_ERR(trans); 6637 err = PTR_ERR(trans);
6681 goto out; 6638 goto out;
6682 } 6639 }
6683 btrfs_set_trans_block_group(trans, inode);
6684 trans->block_rsv = rsv; 6640 trans->block_rsv = rsv;
6685 6641
6686 /* 6642 /*
@@ -6715,7 +6671,6 @@ static int btrfs_truncate(struct inode *inode)
6715 rsv); 6671 rsv);
6716 BUG_ON(ret); 6672 BUG_ON(ret);
6717 6673
6718 btrfs_set_trans_block_group(trans, inode);
6719 trans->block_rsv = rsv; 6674 trans->block_rsv = rsv;
6720 } 6675 }
6721 6676
@@ -6775,15 +6730,14 @@ out:
6775 * create a new subvolume directory/inode (helper for the ioctl). 6730 * create a new subvolume directory/inode (helper for the ioctl).
6776 */ 6731 */
6777int btrfs_create_subvol_root(struct btrfs_trans_handle *trans, 6732int btrfs_create_subvol_root(struct btrfs_trans_handle *trans,
6778 struct btrfs_root *new_root, 6733 struct btrfs_root *new_root, u64 new_dirid)
6779 u64 new_dirid, u64 alloc_hint)
6780{ 6734{
6781 struct inode *inode; 6735 struct inode *inode;
6782 int err; 6736 int err;
6783 u64 index = 0; 6737 u64 index = 0;
6784 6738
6785 inode = btrfs_new_inode(trans, new_root, NULL, "..", 2, new_dirid, 6739 inode = btrfs_new_inode(trans, new_root, NULL, "..", 2, new_dirid,
6786 new_dirid, alloc_hint, S_IFDIR | 0700, &index); 6740 new_dirid, S_IFDIR | 0700, &index);
6787 if (IS_ERR(inode)) 6741 if (IS_ERR(inode))
6788 return PTR_ERR(inode); 6742 return PTR_ERR(inode);
6789 inode->i_op = &btrfs_dir_inode_operations; 6743 inode->i_op = &btrfs_dir_inode_operations;
@@ -6893,21 +6847,6 @@ void btrfs_destroy_inode(struct inode *inode)
6893 spin_unlock(&root->fs_info->ordered_extent_lock); 6847 spin_unlock(&root->fs_info->ordered_extent_lock);
6894 } 6848 }
6895 6849
6896 if (root == root->fs_info->tree_root) {
6897 struct btrfs_block_group_cache *block_group;
6898
6899 block_group = btrfs_lookup_block_group(root->fs_info,
6900 BTRFS_I(inode)->block_group);
6901 if (block_group && block_group->inode == inode) {
6902 spin_lock(&block_group->lock);
6903 block_group->inode = NULL;
6904 spin_unlock(&block_group->lock);
6905 btrfs_put_block_group(block_group);
6906 } else if (block_group) {
6907 btrfs_put_block_group(block_group);
6908 }
6909 }
6910
6911 spin_lock(&root->orphan_lock); 6850 spin_lock(&root->orphan_lock);
6912 if (!list_empty(&BTRFS_I(inode)->i_orphan)) { 6851 if (!list_empty(&BTRFS_I(inode)->i_orphan)) {
6913 printk(KERN_INFO "BTRFS: inode %lu still on the orphan list\n", 6852 printk(KERN_INFO "BTRFS: inode %lu still on the orphan list\n",
@@ -7091,8 +7030,6 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
7091 goto out_notrans; 7030 goto out_notrans;
7092 } 7031 }
7093 7032
7094 btrfs_set_trans_block_group(trans, new_dir);
7095
7096 if (dest != root) 7033 if (dest != root)
7097 btrfs_record_root_in_trans(trans, dest); 7034 btrfs_record_root_in_trans(trans, dest);
7098 7035
@@ -7331,12 +7268,9 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
7331 if (IS_ERR(trans)) 7268 if (IS_ERR(trans))
7332 return PTR_ERR(trans); 7269 return PTR_ERR(trans);
7333 7270
7334 btrfs_set_trans_block_group(trans, dir);
7335
7336 inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name, 7271 inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name,
7337 dentry->d_name.len, dir->i_ino, objectid, 7272 dentry->d_name.len, dir->i_ino, objectid,
7338 BTRFS_I(dir)->block_group, S_IFLNK|S_IRWXUGO, 7273 S_IFLNK|S_IRWXUGO, &index);
7339 &index);
7340 if (IS_ERR(inode)) { 7274 if (IS_ERR(inode)) {
7341 err = PTR_ERR(inode); 7275 err = PTR_ERR(inode);
7342 goto out_unlock; 7276 goto out_unlock;
@@ -7348,7 +7282,6 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
7348 goto out_unlock; 7282 goto out_unlock;
7349 } 7283 }
7350 7284
7351 btrfs_set_trans_block_group(trans, inode);
7352 err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); 7285 err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index);
7353 if (err) 7286 if (err)
7354 drop_inode = 1; 7287 drop_inode = 1;
@@ -7359,8 +7292,6 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
7359 inode->i_op = &btrfs_file_inode_operations; 7292 inode->i_op = &btrfs_file_inode_operations;
7360 BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; 7293 BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops;
7361 } 7294 }
7362 btrfs_update_inode_block_group(trans, inode);
7363 btrfs_update_inode_block_group(trans, dir);
7364 if (drop_inode) 7295 if (drop_inode)
7365 goto out_unlock; 7296 goto out_unlock;
7366 7297