Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

btrfs: rename del_ptr to btrfs_del_ptr and export it

This exists internal to ctree.c, however btrfs check needs to use it for
some of its operations. I'd rather not duplicate that code inside of
btrfs check as this is low level and I want to keep this code in one
place, so rename the function to btrfs_del_ptr and export it so that it
can be used inside of btrfs-progs safely. Add a comment to make sure
this doesn't get removed by a future cleanup.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Josef Bacik and committed by
David Sterba
016f9d0b b3cbfb0d

+10 -8
+8 -8
fs/btrfs/ctree.c
··· 37 37 static int balance_node_right(struct btrfs_trans_handle *trans, 38 38 struct extent_buffer *dst_buf, 39 39 struct extent_buffer *src_buf); 40 - static void del_ptr(struct btrfs_root *root, struct btrfs_path *path, 41 - int level, int slot); 42 40 43 41 static const struct btrfs_csums { 44 42 u16 size; ··· 1120 1122 if (btrfs_header_nritems(right) == 0) { 1121 1123 btrfs_clear_buffer_dirty(trans, right); 1122 1124 btrfs_tree_unlock(right); 1123 - del_ptr(root, path, level + 1, pslot + 1); 1125 + btrfs_del_ptr(root, path, level + 1, pslot + 1); 1124 1126 root_sub_used(root, right->len); 1125 1127 btrfs_free_tree_block(trans, btrfs_root_id(root), right, 1126 1128 0, 1); ··· 1166 1168 if (btrfs_header_nritems(mid) == 0) { 1167 1169 btrfs_clear_buffer_dirty(trans, mid); 1168 1170 btrfs_tree_unlock(mid); 1169 - del_ptr(root, path, level + 1, pslot); 1171 + btrfs_del_ptr(root, path, level + 1, pslot); 1170 1172 root_sub_used(root, mid->len); 1171 1173 btrfs_free_tree_block(trans, btrfs_root_id(root), mid, 0, 1); 1172 1174 free_extent_buffer_stale(mid); ··· 4355 4357 * 4356 4358 * the tree should have been previously balanced so the deletion does not 4357 4359 * empty a node. 4360 + * 4361 + * This is exported for use inside btrfs-progs, don't un-export it. 4358 4362 */ 4359 - static void del_ptr(struct btrfs_root *root, struct btrfs_path *path, 4360 - int level, int slot) 4363 + void btrfs_del_ptr(struct btrfs_root *root, struct btrfs_path *path, int level, 4364 + int slot) 4361 4365 { 4362 4366 struct extent_buffer *parent = path->nodes[level]; 4363 4367 u32 nritems; ··· 4414 4414 struct extent_buffer *leaf) 4415 4415 { 4416 4416 WARN_ON(btrfs_header_generation(leaf) != trans->transid); 4417 - del_ptr(root, path, 1, path->slots[1]); 4417 + btrfs_del_ptr(root, path, 1, path->slots[1]); 4418 4418 4419 4419 /* 4420 4420 * btrfs_free_extent is expensive, we want to make sure we ··· 4500 4500 4501 4501 /* push_leaf_left fixes the path. 4502 4502 * make sure the path still points to our leaf 4503 - * for possible call to del_ptr below 4503 + * for possible call to btrfs_del_ptr below 4504 4504 */ 4505 4505 slot = path->slots[1]; 4506 4506 atomic_inc(&leaf->refs);
+2
fs/btrfs/ctree.h
··· 541 541 struct extent_buffer **cow_ret, u64 new_root_objectid); 542 542 int btrfs_block_can_be_shared(struct btrfs_root *root, 543 543 struct extent_buffer *buf); 544 + void btrfs_del_ptr(struct btrfs_root *root, struct btrfs_path *path, int level, 545 + int slot); 544 546 void btrfs_extend_item(struct btrfs_path *path, u32 data_size); 545 547 void btrfs_truncate_item(struct btrfs_path *path, u32 new_size, int from_end); 546 548 int btrfs_split_item(struct btrfs_trans_handle *trans,