diff options
author | Tsutomu Itoh <t-itoh@jp.fujitsu.com> | 2013-04-16 01:18:22 -0400 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-05-06 15:54:52 -0400 |
commit | afe5fea72bd50b1df2e6a721ef50559427d42f2b (patch) | |
tree | 23c1d3f24f3e861c399425f72bc4929048467ed2 | |
parent | d6a0a12684523d635e0530a9d70a1eba4b8c4fb9 (diff) |
Btrfs: cleanup of function where fixup_low_keys() is called
If argument 'trans' is unnecessary in the function where
fixup_low_keys() is called, 'trans' is deleted.
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
-rw-r--r-- | fs/btrfs/ctree.c | 28 | ||||
-rw-r--r-- | fs/btrfs/ctree.h | 10 | ||||
-rw-r--r-- | fs/btrfs/delayed-inode.c | 11 | ||||
-rw-r--r-- | fs/btrfs/dir-item.c | 3 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 9 | ||||
-rw-r--r-- | fs/btrfs/file-item.c | 11 | ||||
-rw-r--r-- | fs/btrfs/file.c | 8 | ||||
-rw-r--r-- | fs/btrfs/inode-item.c | 4 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 3 | ||||
-rw-r--r-- | fs/btrfs/tree-log.c | 2 |
10 files changed, 38 insertions, 51 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 71442d0d3140..01a8a3bd4492 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -37,8 +37,8 @@ static int balance_node_right(struct btrfs_trans_handle *trans, | |||
37 | struct btrfs_root *root, | 37 | struct btrfs_root *root, |
38 | struct extent_buffer *dst_buf, | 38 | struct extent_buffer *dst_buf, |
39 | struct extent_buffer *src_buf); | 39 | struct extent_buffer *src_buf); |
40 | static void del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 40 | static void del_ptr(struct btrfs_root *root, struct btrfs_path *path, |
41 | struct btrfs_path *path, int level, int slot); | 41 | int level, int slot); |
42 | static void tree_mod_log_free_eb(struct btrfs_fs_info *fs_info, | 42 | static void tree_mod_log_free_eb(struct btrfs_fs_info *fs_info, |
43 | struct extent_buffer *eb); | 43 | struct extent_buffer *eb); |
44 | struct extent_buffer *read_old_tree_block(struct btrfs_root *root, u64 bytenr, | 44 | struct extent_buffer *read_old_tree_block(struct btrfs_root *root, u64 bytenr, |
@@ -1830,7 +1830,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, | |||
1830 | if (btrfs_header_nritems(right) == 0) { | 1830 | if (btrfs_header_nritems(right) == 0) { |
1831 | clean_tree_block(trans, root, right); | 1831 | clean_tree_block(trans, root, right); |
1832 | btrfs_tree_unlock(right); | 1832 | btrfs_tree_unlock(right); |
1833 | del_ptr(trans, root, path, level + 1, pslot + 1); | 1833 | del_ptr(root, path, level + 1, pslot + 1); |
1834 | root_sub_used(root, right->len); | 1834 | root_sub_used(root, right->len); |
1835 | btrfs_free_tree_block(trans, root, right, 0, 1); | 1835 | btrfs_free_tree_block(trans, root, right, 0, 1); |
1836 | free_extent_buffer_stale(right); | 1836 | free_extent_buffer_stale(right); |
@@ -1874,7 +1874,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, | |||
1874 | if (btrfs_header_nritems(mid) == 0) { | 1874 | if (btrfs_header_nritems(mid) == 0) { |
1875 | clean_tree_block(trans, root, mid); | 1875 | clean_tree_block(trans, root, mid); |
1876 | btrfs_tree_unlock(mid); | 1876 | btrfs_tree_unlock(mid); |
1877 | del_ptr(trans, root, path, level + 1, pslot); | 1877 | del_ptr(root, path, level + 1, pslot); |
1878 | root_sub_used(root, mid->len); | 1878 | root_sub_used(root, mid->len); |
1879 | btrfs_free_tree_block(trans, root, mid, 0, 1); | 1879 | btrfs_free_tree_block(trans, root, mid, 0, 1); |
1880 | free_extent_buffer_stale(mid); | 1880 | free_extent_buffer_stale(mid); |
@@ -2930,8 +2930,7 @@ static void fixup_low_keys(struct btrfs_root *root, struct btrfs_path *path, | |||
2930 | * This function isn't completely safe. It's the caller's responsibility | 2930 | * This function isn't completely safe. It's the caller's responsibility |
2931 | * that the new key won't break the order | 2931 | * that the new key won't break the order |
2932 | */ | 2932 | */ |
2933 | void btrfs_set_item_key_safe(struct btrfs_trans_handle *trans, | 2933 | void btrfs_set_item_key_safe(struct btrfs_root *root, struct btrfs_path *path, |
2934 | struct btrfs_root *root, struct btrfs_path *path, | ||
2935 | struct btrfs_key *new_key) | 2934 | struct btrfs_key *new_key) |
2936 | { | 2935 | { |
2937 | struct btrfs_disk_key disk_key; | 2936 | struct btrfs_disk_key disk_key; |
@@ -4267,7 +4266,7 @@ int btrfs_duplicate_item(struct btrfs_trans_handle *trans, | |||
4267 | return ret; | 4266 | return ret; |
4268 | 4267 | ||
4269 | path->slots[0]++; | 4268 | path->slots[0]++; |
4270 | setup_items_for_insert(trans, root, path, new_key, &item_size, | 4269 | setup_items_for_insert(root, path, new_key, &item_size, |
4271 | item_size, item_size + | 4270 | item_size, item_size + |
4272 | sizeof(struct btrfs_item), 1); | 4271 | sizeof(struct btrfs_item), 1); |
4273 | leaf = path->nodes[0]; | 4272 | leaf = path->nodes[0]; |
@@ -4284,9 +4283,7 @@ int btrfs_duplicate_item(struct btrfs_trans_handle *trans, | |||
4284 | * off the end of the item or if we shift the item to chop bytes off | 4283 | * off the end of the item or if we shift the item to chop bytes off |
4285 | * the front. | 4284 | * the front. |
4286 | */ | 4285 | */ |
4287 | void btrfs_truncate_item(struct btrfs_trans_handle *trans, | 4286 | void btrfs_truncate_item(struct btrfs_root *root, struct btrfs_path *path, |
4288 | struct btrfs_root *root, | ||
4289 | struct btrfs_path *path, | ||
4290 | u32 new_size, int from_end) | 4287 | u32 new_size, int from_end) |
4291 | { | 4288 | { |
4292 | int slot; | 4289 | int slot; |
@@ -4457,8 +4454,7 @@ void btrfs_extend_item(struct btrfs_trans_handle *trans, | |||
4457 | * to save stack depth by doing the bulk of the work in a function | 4454 | * to save stack depth by doing the bulk of the work in a function |
4458 | * that doesn't call btrfs_search_slot | 4455 | * that doesn't call btrfs_search_slot |
4459 | */ | 4456 | */ |
4460 | void setup_items_for_insert(struct btrfs_trans_handle *trans, | 4457 | void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path, |
4461 | struct btrfs_root *root, struct btrfs_path *path, | ||
4462 | struct btrfs_key *cpu_key, u32 *data_size, | 4458 | struct btrfs_key *cpu_key, u32 *data_size, |
4463 | u32 total_data, u32 total_size, int nr) | 4459 | u32 total_data, u32 total_size, int nr) |
4464 | { | 4460 | { |
@@ -4574,7 +4570,7 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans, | |||
4574 | slot = path->slots[0]; | 4570 | slot = path->slots[0]; |
4575 | BUG_ON(slot < 0); | 4571 | BUG_ON(slot < 0); |
4576 | 4572 | ||
4577 | setup_items_for_insert(trans, root, path, cpu_key, data_size, | 4573 | setup_items_for_insert(root, path, cpu_key, data_size, |
4578 | total_data, total_size, nr); | 4574 | total_data, total_size, nr); |
4579 | return 0; | 4575 | return 0; |
4580 | } | 4576 | } |
@@ -4612,8 +4608,8 @@ int btrfs_insert_item(struct btrfs_trans_handle *trans, struct btrfs_root | |||
4612 | * the tree should have been previously balanced so the deletion does not | 4608 | * the tree should have been previously balanced so the deletion does not |
4613 | * empty a node. | 4609 | * empty a node. |
4614 | */ | 4610 | */ |
4615 | static void del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 4611 | static void del_ptr(struct btrfs_root *root, struct btrfs_path *path, |
4616 | struct btrfs_path *path, int level, int slot) | 4612 | int level, int slot) |
4617 | { | 4613 | { |
4618 | struct extent_buffer *parent = path->nodes[level]; | 4614 | struct extent_buffer *parent = path->nodes[level]; |
4619 | u32 nritems; | 4615 | u32 nritems; |
@@ -4666,7 +4662,7 @@ static noinline void btrfs_del_leaf(struct btrfs_trans_handle *trans, | |||
4666 | struct extent_buffer *leaf) | 4662 | struct extent_buffer *leaf) |
4667 | { | 4663 | { |
4668 | WARN_ON(btrfs_header_generation(leaf) != trans->transid); | 4664 | WARN_ON(btrfs_header_generation(leaf) != trans->transid); |
4669 | del_ptr(trans, root, path, 1, path->slots[1]); | 4665 | del_ptr(root, path, 1, path->slots[1]); |
4670 | 4666 | ||
4671 | /* | 4667 | /* |
4672 | * btrfs_free_extent is expensive, we want to make sure we | 4668 | * btrfs_free_extent is expensive, we want to make sure we |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index c3b15f8dca00..84d6d5cb02f6 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -3183,8 +3183,7 @@ int btrfs_comp_cpu_keys(struct btrfs_key *k1, struct btrfs_key *k2); | |||
3183 | int btrfs_previous_item(struct btrfs_root *root, | 3183 | int btrfs_previous_item(struct btrfs_root *root, |
3184 | struct btrfs_path *path, u64 min_objectid, | 3184 | struct btrfs_path *path, u64 min_objectid, |
3185 | int type); | 3185 | int type); |
3186 | void btrfs_set_item_key_safe(struct btrfs_trans_handle *trans, | 3186 | void btrfs_set_item_key_safe(struct btrfs_root *root, struct btrfs_path *path, |
3187 | struct btrfs_root *root, struct btrfs_path *path, | ||
3188 | struct btrfs_key *new_key); | 3187 | struct btrfs_key *new_key); |
3189 | struct extent_buffer *btrfs_root_node(struct btrfs_root *root); | 3188 | struct extent_buffer *btrfs_root_node(struct btrfs_root *root); |
3190 | struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root); | 3189 | struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root); |
@@ -3223,9 +3222,7 @@ int btrfs_block_can_be_shared(struct btrfs_root *root, | |||
3223 | void btrfs_extend_item(struct btrfs_trans_handle *trans, | 3222 | void btrfs_extend_item(struct btrfs_trans_handle *trans, |
3224 | struct btrfs_root *root, struct btrfs_path *path, | 3223 | struct btrfs_root *root, struct btrfs_path *path, |
3225 | u32 data_size); | 3224 | u32 data_size); |
3226 | void btrfs_truncate_item(struct btrfs_trans_handle *trans, | 3225 | void btrfs_truncate_item(struct btrfs_root *root, struct btrfs_path *path, |
3227 | struct btrfs_root *root, | ||
3228 | struct btrfs_path *path, | ||
3229 | u32 new_size, int from_end); | 3226 | u32 new_size, int from_end); |
3230 | int btrfs_split_item(struct btrfs_trans_handle *trans, | 3227 | int btrfs_split_item(struct btrfs_trans_handle *trans, |
3231 | struct btrfs_root *root, | 3228 | struct btrfs_root *root, |
@@ -3265,8 +3262,7 @@ static inline int btrfs_del_item(struct btrfs_trans_handle *trans, | |||
3265 | return btrfs_del_items(trans, root, path, path->slots[0], 1); | 3262 | return btrfs_del_items(trans, root, path, path->slots[0], 1); |
3266 | } | 3263 | } |
3267 | 3264 | ||
3268 | void setup_items_for_insert(struct btrfs_trans_handle *trans, | 3265 | void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path, |
3269 | struct btrfs_root *root, struct btrfs_path *path, | ||
3270 | struct btrfs_key *cpu_key, u32 *data_size, | 3266 | struct btrfs_key *cpu_key, u32 *data_size, |
3271 | u32 total_data, u32 total_size, int nr); | 3267 | u32 total_data, u32 total_size, int nr); |
3272 | int btrfs_insert_item(struct btrfs_trans_handle *trans, struct btrfs_root | 3268 | int btrfs_insert_item(struct btrfs_trans_handle *trans, struct btrfs_root |
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 14fce27b4780..71b78c27496d 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c | |||
@@ -766,10 +766,9 @@ static void btrfs_delayed_inode_release_metadata(struct btrfs_root *root, | |||
766 | * This helper will insert some continuous items into the same leaf according | 766 | * This helper will insert some continuous items into the same leaf according |
767 | * to the free space of the leaf. | 767 | * to the free space of the leaf. |
768 | */ | 768 | */ |
769 | static int btrfs_batch_insert_items(struct btrfs_trans_handle *trans, | 769 | static int btrfs_batch_insert_items(struct btrfs_root *root, |
770 | struct btrfs_root *root, | 770 | struct btrfs_path *path, |
771 | struct btrfs_path *path, | 771 | struct btrfs_delayed_item *item) |
772 | struct btrfs_delayed_item *item) | ||
773 | { | 772 | { |
774 | struct btrfs_delayed_item *curr, *next; | 773 | struct btrfs_delayed_item *curr, *next; |
775 | int free_space; | 774 | int free_space; |
@@ -848,7 +847,7 @@ static int btrfs_batch_insert_items(struct btrfs_trans_handle *trans, | |||
848 | btrfs_clear_path_blocking(path, NULL, 0); | 847 | btrfs_clear_path_blocking(path, NULL, 0); |
849 | 848 | ||
850 | /* insert the keys of the items */ | 849 | /* insert the keys of the items */ |
851 | setup_items_for_insert(trans, root, path, keys, data_size, | 850 | setup_items_for_insert(root, path, keys, data_size, |
852 | total_data_size, total_size, nitems); | 851 | total_data_size, total_size, nitems); |
853 | 852 | ||
854 | /* insert the dir index items */ | 853 | /* insert the dir index items */ |
@@ -932,7 +931,7 @@ do_again: | |||
932 | if (curr && btrfs_is_continuous_delayed_item(prev, curr)) { | 931 | if (curr && btrfs_is_continuous_delayed_item(prev, curr)) { |
933 | /* insert the continuous items into the same leaf */ | 932 | /* insert the continuous items into the same leaf */ |
934 | path->slots[0]++; | 933 | path->slots[0]++; |
935 | btrfs_batch_insert_items(trans, root, path, curr); | 934 | btrfs_batch_insert_items(root, path, curr); |
936 | } | 935 | } |
937 | btrfs_release_delayed_item(prev); | 936 | btrfs_release_delayed_item(prev); |
938 | btrfs_mark_buffer_dirty(path->nodes[0]); | 937 | btrfs_mark_buffer_dirty(path->nodes[0]); |
diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c index 502c2158167c..47cab8dd9f15 100644 --- a/fs/btrfs/dir-item.c +++ b/fs/btrfs/dir-item.c | |||
@@ -442,8 +442,7 @@ int btrfs_delete_one_dir_name(struct btrfs_trans_handle *trans, | |||
442 | start = btrfs_item_ptr_offset(leaf, path->slots[0]); | 442 | start = btrfs_item_ptr_offset(leaf, path->slots[0]); |
443 | memmove_extent_buffer(leaf, ptr, ptr + sub_item_len, | 443 | memmove_extent_buffer(leaf, ptr, ptr + sub_item_len, |
444 | item_len - (ptr + sub_item_len - start)); | 444 | item_len - (ptr + sub_item_len - start)); |
445 | btrfs_truncate_item(trans, root, path, | 445 | btrfs_truncate_item(root, path, item_len - sub_item_len, 1); |
446 | item_len - sub_item_len, 1); | ||
447 | } | 446 | } |
448 | return ret; | 447 | return ret; |
449 | } | 448 | } |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index bea20feed2ab..40692f61e4b6 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -1752,8 +1752,7 @@ static int lookup_extent_backref(struct btrfs_trans_handle *trans, | |||
1752 | * helper to update/remove inline back ref | 1752 | * helper to update/remove inline back ref |
1753 | */ | 1753 | */ |
1754 | static noinline_for_stack | 1754 | static noinline_for_stack |
1755 | void update_inline_extent_backref(struct btrfs_trans_handle *trans, | 1755 | void update_inline_extent_backref(struct btrfs_root *root, |
1756 | struct btrfs_root *root, | ||
1757 | struct btrfs_path *path, | 1756 | struct btrfs_path *path, |
1758 | struct btrfs_extent_inline_ref *iref, | 1757 | struct btrfs_extent_inline_ref *iref, |
1759 | int refs_to_mod, | 1758 | int refs_to_mod, |
@@ -1809,7 +1808,7 @@ void update_inline_extent_backref(struct btrfs_trans_handle *trans, | |||
1809 | memmove_extent_buffer(leaf, ptr, ptr + size, | 1808 | memmove_extent_buffer(leaf, ptr, ptr + size, |
1810 | end - ptr - size); | 1809 | end - ptr - size); |
1811 | item_size -= size; | 1810 | item_size -= size; |
1812 | btrfs_truncate_item(trans, root, path, item_size, 1); | 1811 | btrfs_truncate_item(root, path, item_size, 1); |
1813 | } | 1812 | } |
1814 | btrfs_mark_buffer_dirty(leaf); | 1813 | btrfs_mark_buffer_dirty(leaf); |
1815 | } | 1814 | } |
@@ -1831,7 +1830,7 @@ int insert_inline_extent_backref(struct btrfs_trans_handle *trans, | |||
1831 | root_objectid, owner, offset, 1); | 1830 | root_objectid, owner, offset, 1); |
1832 | if (ret == 0) { | 1831 | if (ret == 0) { |
1833 | BUG_ON(owner < BTRFS_FIRST_FREE_OBJECTID); | 1832 | BUG_ON(owner < BTRFS_FIRST_FREE_OBJECTID); |
1834 | update_inline_extent_backref(trans, root, path, iref, | 1833 | update_inline_extent_backref(root, path, iref, |
1835 | refs_to_add, extent_op); | 1834 | refs_to_add, extent_op); |
1836 | } else if (ret == -ENOENT) { | 1835 | } else if (ret == -ENOENT) { |
1837 | setup_inline_extent_backref(trans, root, path, iref, parent, | 1836 | setup_inline_extent_backref(trans, root, path, iref, parent, |
@@ -1871,7 +1870,7 @@ static int remove_extent_backref(struct btrfs_trans_handle *trans, | |||
1871 | 1870 | ||
1872 | BUG_ON(!is_data && refs_to_drop != 1); | 1871 | BUG_ON(!is_data && refs_to_drop != 1); |
1873 | if (iref) { | 1872 | if (iref) { |
1874 | update_inline_extent_backref(trans, root, path, iref, | 1873 | update_inline_extent_backref(root, path, iref, |
1875 | -refs_to_drop, NULL); | 1874 | -refs_to_drop, NULL); |
1876 | } else if (is_data) { | 1875 | } else if (is_data) { |
1877 | ret = remove_extent_data_ref(trans, root, path, refs_to_drop); | 1876 | ret = remove_extent_data_ref(trans, root, path, refs_to_drop); |
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index 18f12aab6ebf..ea14ecb0af47 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c | |||
@@ -525,8 +525,7 @@ int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode, | |||
525 | * This calls btrfs_truncate_item with the correct args based on the | 525 | * This calls btrfs_truncate_item with the correct args based on the |
526 | * overlap, and fixes up the key as required. | 526 | * overlap, and fixes up the key as required. |
527 | */ | 527 | */ |
528 | static noinline void truncate_one_csum(struct btrfs_trans_handle *trans, | 528 | static noinline void truncate_one_csum(struct btrfs_root *root, |
529 | struct btrfs_root *root, | ||
530 | struct btrfs_path *path, | 529 | struct btrfs_path *path, |
531 | struct btrfs_key *key, | 530 | struct btrfs_key *key, |
532 | u64 bytenr, u64 len) | 531 | u64 bytenr, u64 len) |
@@ -551,7 +550,7 @@ static noinline void truncate_one_csum(struct btrfs_trans_handle *trans, | |||
551 | */ | 550 | */ |
552 | u32 new_size = (bytenr - key->offset) >> blocksize_bits; | 551 | u32 new_size = (bytenr - key->offset) >> blocksize_bits; |
553 | new_size *= csum_size; | 552 | new_size *= csum_size; |
554 | btrfs_truncate_item(trans, root, path, new_size, 1); | 553 | btrfs_truncate_item(root, path, new_size, 1); |
555 | } else if (key->offset >= bytenr && csum_end > end_byte && | 554 | } else if (key->offset >= bytenr && csum_end > end_byte && |
556 | end_byte > key->offset) { | 555 | end_byte > key->offset) { |
557 | /* | 556 | /* |
@@ -563,10 +562,10 @@ static noinline void truncate_one_csum(struct btrfs_trans_handle *trans, | |||
563 | u32 new_size = (csum_end - end_byte) >> blocksize_bits; | 562 | u32 new_size = (csum_end - end_byte) >> blocksize_bits; |
564 | new_size *= csum_size; | 563 | new_size *= csum_size; |
565 | 564 | ||
566 | btrfs_truncate_item(trans, root, path, new_size, 0); | 565 | btrfs_truncate_item(root, path, new_size, 0); |
567 | 566 | ||
568 | key->offset = end_byte; | 567 | key->offset = end_byte; |
569 | btrfs_set_item_key_safe(trans, root, path, key); | 568 | btrfs_set_item_key_safe(root, path, key); |
570 | } else { | 569 | } else { |
571 | BUG(); | 570 | BUG(); |
572 | } | 571 | } |
@@ -681,7 +680,7 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans, | |||
681 | 680 | ||
682 | key.offset = end_byte - 1; | 681 | key.offset = end_byte - 1; |
683 | } else { | 682 | } else { |
684 | truncate_one_csum(trans, root, path, &key, bytenr, len); | 683 | truncate_one_csum(root, path, &key, bytenr, len); |
685 | if (key.offset < bytenr) | 684 | if (key.offset < bytenr) |
686 | break; | 685 | break; |
687 | } | 686 | } |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index a56abed78104..bef15c3ef41d 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -824,7 +824,7 @@ next_slot: | |||
824 | 824 | ||
825 | memcpy(&new_key, &key, sizeof(new_key)); | 825 | memcpy(&new_key, &key, sizeof(new_key)); |
826 | new_key.offset = end; | 826 | new_key.offset = end; |
827 | btrfs_set_item_key_safe(trans, root, path, &new_key); | 827 | btrfs_set_item_key_safe(root, path, &new_key); |
828 | 828 | ||
829 | extent_offset += end - key.offset; | 829 | extent_offset += end - key.offset; |
830 | btrfs_set_file_extent_offset(leaf, fi, extent_offset); | 830 | btrfs_set_file_extent_offset(leaf, fi, extent_offset); |
@@ -1040,7 +1040,7 @@ again: | |||
1040 | ino, bytenr, orig_offset, | 1040 | ino, bytenr, orig_offset, |
1041 | &other_start, &other_end)) { | 1041 | &other_start, &other_end)) { |
1042 | new_key.offset = end; | 1042 | new_key.offset = end; |
1043 | btrfs_set_item_key_safe(trans, root, path, &new_key); | 1043 | btrfs_set_item_key_safe(root, path, &new_key); |
1044 | fi = btrfs_item_ptr(leaf, path->slots[0], | 1044 | fi = btrfs_item_ptr(leaf, path->slots[0], |
1045 | struct btrfs_file_extent_item); | 1045 | struct btrfs_file_extent_item); |
1046 | btrfs_set_file_extent_generation(leaf, fi, | 1046 | btrfs_set_file_extent_generation(leaf, fi, |
@@ -1074,7 +1074,7 @@ again: | |||
1074 | trans->transid); | 1074 | trans->transid); |
1075 | path->slots[0]++; | 1075 | path->slots[0]++; |
1076 | new_key.offset = start; | 1076 | new_key.offset = start; |
1077 | btrfs_set_item_key_safe(trans, root, path, &new_key); | 1077 | btrfs_set_item_key_safe(root, path, &new_key); |
1078 | 1078 | ||
1079 | fi = btrfs_item_ptr(leaf, path->slots[0], | 1079 | fi = btrfs_item_ptr(leaf, path->slots[0], |
1080 | struct btrfs_file_extent_item); | 1080 | struct btrfs_file_extent_item); |
@@ -1888,7 +1888,7 @@ static int fill_holes(struct btrfs_trans_handle *trans, struct inode *inode, | |||
1888 | 1888 | ||
1889 | path->slots[0]++; | 1889 | path->slots[0]++; |
1890 | key.offset = offset; | 1890 | key.offset = offset; |
1891 | btrfs_set_item_key_safe(trans, root, path, &key); | 1891 | btrfs_set_item_key_safe(root, path, &key); |
1892 | fi = btrfs_item_ptr(leaf, path->slots[0], | 1892 | fi = btrfs_item_ptr(leaf, path->slots[0], |
1893 | struct btrfs_file_extent_item); | 1893 | struct btrfs_file_extent_item); |
1894 | num_bytes = btrfs_file_extent_num_bytes(leaf, fi) + end - | 1894 | num_bytes = btrfs_file_extent_num_bytes(leaf, fi) + end - |
diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c index 48b8fda93132..cb44398885ba 100644 --- a/fs/btrfs/inode-item.c +++ b/fs/btrfs/inode-item.c | |||
@@ -246,7 +246,7 @@ int btrfs_del_inode_extref(struct btrfs_trans_handle *trans, | |||
246 | memmove_extent_buffer(leaf, ptr, ptr + del_len, | 246 | memmove_extent_buffer(leaf, ptr, ptr + del_len, |
247 | item_size - (ptr + del_len - item_start)); | 247 | item_size - (ptr + del_len - item_start)); |
248 | 248 | ||
249 | btrfs_truncate_item(trans, root, path, item_size - del_len, 1); | 249 | btrfs_truncate_item(root, path, item_size - del_len, 1); |
250 | 250 | ||
251 | out: | 251 | out: |
252 | btrfs_free_path(path); | 252 | btrfs_free_path(path); |
@@ -309,7 +309,7 @@ int btrfs_del_inode_ref(struct btrfs_trans_handle *trans, | |||
309 | item_start = btrfs_item_ptr_offset(leaf, path->slots[0]); | 309 | item_start = btrfs_item_ptr_offset(leaf, path->slots[0]); |
310 | memmove_extent_buffer(leaf, ptr, ptr + sub_item_len, | 310 | memmove_extent_buffer(leaf, ptr, ptr + sub_item_len, |
311 | item_size - (ptr + sub_item_len - item_start)); | 311 | item_size - (ptr + sub_item_len - item_start)); |
312 | btrfs_truncate_item(trans, root, path, item_size - sub_item_len, 1); | 312 | btrfs_truncate_item(root, path, item_size - sub_item_len, 1); |
313 | out: | 313 | out: |
314 | btrfs_free_path(path); | 314 | btrfs_free_path(path); |
315 | 315 | ||
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index ca4051713633..d65a55c9be8a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4178,8 +4178,7 @@ search_again: | |||
4178 | } | 4178 | } |
4179 | size = | 4179 | size = |
4180 | btrfs_file_extent_calc_inline_size(size); | 4180 | btrfs_file_extent_calc_inline_size(size); |
4181 | btrfs_truncate_item(trans, root, path, | 4181 | btrfs_truncate_item(root, path, size, 1); |
4182 | size, 1); | ||
4183 | } else if (root->ref_cows) { | 4182 | } else if (root->ref_cows) { |
4184 | inode_sub_bytes(inode, item_end + 1 - | 4183 | inode_sub_bytes(inode, item_end + 1 - |
4185 | found_key.offset); | 4184 | found_key.offset); |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index b069fafbc3de..3442dd900e19 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -408,7 +408,7 @@ insert: | |||
408 | found_size = btrfs_item_size_nr(path->nodes[0], | 408 | found_size = btrfs_item_size_nr(path->nodes[0], |
409 | path->slots[0]); | 409 | path->slots[0]); |
410 | if (found_size > item_size) | 410 | if (found_size > item_size) |
411 | btrfs_truncate_item(trans, root, path, item_size, 1); | 411 | btrfs_truncate_item(root, path, item_size, 1); |
412 | else if (found_size < item_size) | 412 | else if (found_size < item_size) |
413 | btrfs_extend_item(trans, root, path, | 413 | btrfs_extend_item(trans, root, path, |
414 | item_size - found_size); | 414 | item_size - found_size); |