@@ -52,7 +52,7 @@ static void print_extents(struct extent_buffer *eb)
return;
if (btrfs_is_leaf(eb)) {
- btrfs_print_leaf(eb, BTRFS_PRINT_TREE_DEFAULT);
+ btrfs_print_leaf(eb);
return;
}
@@ -2418,7 +2418,7 @@ split:
ret = 0;
if (btrfs_leaf_free_space(leaf) < 0) {
- btrfs_print_leaf(leaf, BTRFS_PRINT_TREE_DEFAULT);
+ btrfs_print_leaf(leaf);
BUG();
}
kfree(buf);
@@ -2510,7 +2510,7 @@ int btrfs_truncate_item(struct btrfs_path *path, u32 new_size, int from_end)
ret = 0;
if (btrfs_leaf_free_space(leaf) < 0) {
- btrfs_print_leaf(leaf, BTRFS_PRINT_TREE_DEFAULT);
+ btrfs_print_leaf(leaf);
BUG();
}
return ret;
@@ -2534,7 +2534,7 @@ int btrfs_extend_item(struct btrfs_root *root, struct btrfs_path *path,
data_end = leaf_data_end(leaf);
if (btrfs_leaf_free_space(leaf) < data_size) {
- btrfs_print_leaf(leaf, BTRFS_PRINT_TREE_DEFAULT);
+ btrfs_print_leaf(leaf);
BUG();
}
slot = path->slots[0];
@@ -2542,7 +2542,7 @@ int btrfs_extend_item(struct btrfs_root *root, struct btrfs_path *path,
BUG_ON(slot < 0);
if (slot >= nritems) {
- btrfs_print_leaf(leaf, BTRFS_PRINT_TREE_DEFAULT);
+ btrfs_print_leaf(leaf);
printk("slot %d too large, nritems %u\n", slot, nritems);
BUG_ON(1);
}
@@ -2569,7 +2569,7 @@ int btrfs_extend_item(struct btrfs_root *root, struct btrfs_path *path,
ret = 0;
if (btrfs_leaf_free_space(leaf) < 0) {
- btrfs_print_leaf(leaf, BTRFS_PRINT_TREE_DEFAULT);
+ btrfs_print_leaf(leaf);
BUG();
}
return ret;
@@ -2617,7 +2617,7 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
data_end = leaf_data_end(leaf);
if (btrfs_leaf_free_space(leaf) < total_size) {
- btrfs_print_leaf(leaf, BTRFS_PRINT_TREE_DEFAULT);
+ btrfs_print_leaf(leaf);
printk("not enough freespace need %u have %d\n",
total_size, btrfs_leaf_free_space(leaf));
BUG();
@@ -2630,7 +2630,7 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
unsigned int old_data = btrfs_item_data_end(leaf, slot);
if (old_data < data_end) {
- btrfs_print_leaf(leaf, BTRFS_PRINT_TREE_DEFAULT);
+ btrfs_print_leaf(leaf);
printk("slot %d old_data %u data_end %u\n",
slot, old_data, data_end);
BUG_ON(1);
@@ -2676,7 +2676,7 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
}
if (btrfs_leaf_free_space(leaf) < 0) {
- btrfs_print_leaf(leaf, BTRFS_PRINT_TREE_DEFAULT);
+ btrfs_print_leaf(leaf);
BUG();
}
@@ -937,7 +937,7 @@ again:
printf("Size is %u, needs to be %u, slot %d\n",
(unsigned)item_size,
(unsigned)sizeof(*ei), path->slots[0]);
- btrfs_print_leaf(leaf, BTRFS_PRINT_TREE_DEFAULT);
+ btrfs_print_leaf(leaf);
return -EINVAL;
}
@@ -1428,7 +1428,7 @@ again:
}
if (ret != 0) {
- btrfs_print_leaf(path->nodes[0], BTRFS_PRINT_TREE_DEFAULT);
+ btrfs_print_leaf(path->nodes[0]);
printk("failed to find block number %llu\n",
(unsigned long long)bytenr);
BUG();
@@ -2034,7 +2034,7 @@ static int __free_extent(struct btrfs_trans_handle *trans,
printk(KERN_ERR "umm, got %d back from search"
", was looking for %llu\n", ret,
(unsigned long long)bytenr);
- btrfs_print_leaf(path->nodes[0], BTRFS_PRINT_TREE_DEFAULT);
+ btrfs_print_leaf(path->nodes[0]);
}
BUG_ON(ret);
extent_slot = path->slots[0];
@@ -2048,7 +2048,7 @@ static int __free_extent(struct btrfs_trans_handle *trans,
(unsigned long long)owner_objectid,
(unsigned long long)owner_offset);
printf("path->slots[0]: %d path->nodes[0]:\n", path->slots[0]);
- btrfs_print_leaf(path->nodes[0], BTRFS_PRINT_TREE_DEFAULT);
+ btrfs_print_leaf(path->nodes[0]);
ret = -EIO;
goto fail;
}
@@ -1294,7 +1294,7 @@ static void print_header_info(struct extent_buffer *eb, unsigned int mode)
fflush(stdout);
}
-void btrfs_print_leaf(struct extent_buffer *eb, unsigned int mode)
+void __btrfs_print_leaf(struct extent_buffer *eb, unsigned int mode)
{
struct btrfs_disk_key disk_key;
u32 leaf_data_size = BTRFS_LEAF_DATA_SIZE(eb->fs_info);
@@ -1607,7 +1607,7 @@ void btrfs_print_tree(struct extent_buffer *eb, unsigned int mode)
nr = btrfs_header_nritems(eb);
if (btrfs_is_leaf(eb)) {
- btrfs_print_leaf(eb, mode);
+ __btrfs_print_leaf(eb, mode);
return;
}
/* We are crossing eb boundary, this node must be corrupted */
@@ -34,7 +34,12 @@ enum {
};
void btrfs_print_tree(struct extent_buffer *eb, unsigned int mode);
-void btrfs_print_leaf(struct extent_buffer *eb, unsigned int mode);
+void __btrfs_print_leaf(struct extent_buffer *eb, unsigned int mode);
+
+static inline void btrfs_print_leaf(struct extent_buffer *eb)
+{
+ __btrfs_print_leaf(eb, BTRFS_PRINT_TREE_DEFAULT);
+}
void btrfs_print_key(struct btrfs_disk_key *disk_key);
void print_chunk_item(struct extent_buffer *eb, struct btrfs_chunk *chunk);
In the kernel we have btrfs_print_leaf(eb) instead of btrfs_print_leaf(eb, mode). In fact in all of the kernel-shared sources we're just using the default mode. Fix this to have a __btrfs_print_leaf() which handles the mode for the user space utilities that want the different behavior, and then change btrfs_print_leaf() to just be the normal default style. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- cmds/inspect-dump-tree.c | 2 +- kernel-shared/ctree.c | 16 ++++++++-------- kernel-shared/extent-tree.c | 8 ++++---- kernel-shared/print-tree.c | 4 ++-- kernel-shared/print-tree.h | 7 ++++++- 5 files changed, 21 insertions(+), 16 deletions(-)