mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-30 09:21:45 +00:00
btrfs-progs: update btrfs_print_leaf to match the kernel definition
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> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
8ea15251e7
commit
58a96d5230
@ -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;
|
||||
}
|
||||
|
||||
|
@ -2566,7 +2566,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);
|
||||
@ -2658,7 +2658,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;
|
||||
@ -2682,7 +2682,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];
|
||||
@ -2690,7 +2690,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);
|
||||
}
|
||||
@ -2717,7 +2717,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;
|
||||
@ -2765,7 +2765,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();
|
||||
@ -2778,7 +2778,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);
|
||||
@ -2824,7 +2824,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();
|
||||
}
|
||||
|
||||
|
@ -936,7 +936,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;
|
||||
}
|
||||
|
||||
@ -1427,7 +1427,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();
|
||||
@ -2033,7 +2033,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];
|
||||
@ -2047,7 +2047,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;
|
||||
}
|
||||
|
@ -1369,7 +1369,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);
|
||||
@ -1688,7 +1688,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);
|
||||
|
Loading…
Reference in New Issue
Block a user