summaryrefslogtreecommitdiff
path: root/print-tree.c
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2016-05-10 10:13:23 +0100
committerDimitri John Ledkov <xnox@ubuntu.com>2016-05-10 10:13:23 +0100
commit58e631d01823afd60e52f3a09887f270a91889a0 (patch)
tree6afbca5492c1ad1040608e01fe0c9d909482adeb /print-tree.c
parentcec572daccafa1e912cbed363df6f84687778c6f (diff)
New upstream release 4.5.2.
* Thanks for NMU of package rename. * New upstream release 4.5.2. * Upload using dgit. * Source-only upload. * btrfs-convert should not be included in the initramfs, but should be compiled. Using btrfs-convert is not a trivial operation, and especially not from a minimal shell. Also it is known to fail, and for a sophisticated user it is trivial to include it in the initramfs. Thus won't fix Closes: #801192 * No sponsorship required Closes: #823474 * Add Provides btrfs-tools-udeb to the -progs-udeb package.
Diffstat (limited to 'print-tree.c')
-rw-r--r--print-tree.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/print-tree.c b/print-tree.c
index 6704ff68..746f25be 100644
--- a/print-tree.c
+++ b/print-tree.c
@@ -285,19 +285,40 @@ static void print_uuids(struct extent_buffer *eb)
printf("fs uuid %s\nchunk uuid %s\n", fs_uuid, chunk_uuid);
}
+static void compress_type_to_str(u8 compress_type, char *ret)
+{
+ switch (compress_type) {
+ case BTRFS_COMPRESS_NONE:
+ strcpy(ret, "none");
+ break;
+ case BTRFS_COMPRESS_ZLIB:
+ strcpy(ret, "zlib");
+ break;
+ case BTRFS_COMPRESS_LZO:
+ strcpy(ret, "lzo");
+ break;
+ default:
+ sprintf(ret, "UNKNOWN.%d", compress_type);
+ }
+}
+
static void print_file_extent_item(struct extent_buffer *eb,
struct btrfs_item *item,
int slot,
struct btrfs_file_extent_item *fi)
{
int extent_type = btrfs_file_extent_type(eb, fi);
+ char compress_str[16];
+
+ compress_type_to_str(btrfs_file_extent_compression(eb, fi),
+ compress_str);
if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
printf("\t\tinline extent data size %u "
- "ram %u compress %d\n",
+ "ram %u compress(%s)\n",
btrfs_file_extent_inline_item_len(eb, item),
btrfs_file_extent_inline_len(eb, slot, fi),
- btrfs_file_extent_compression(eb, fi));
+ compress_str);
return;
}
if (extent_type == BTRFS_FILE_EXTENT_PREALLOC) {
@@ -316,8 +337,7 @@ static void print_file_extent_item(struct extent_buffer *eb,
(unsigned long long)btrfs_file_extent_offset(eb, fi),
(unsigned long long)btrfs_file_extent_num_bytes(eb, fi),
(unsigned long long)btrfs_file_extent_ram_bytes(eb, fi));
- printf("\t\textent compression %d\n",
- btrfs_file_extent_compression(eb, fi));
+ printf("\t\textent compression(%s)\n", compress_str);
}
/* Caller should ensure sizeof(*ret) >= 16("DATA|TREE_BLOCK") */
@@ -1098,7 +1118,7 @@ void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *eb, int fol
(unsigned long long)btrfs_header_owner(eb));
print_uuids(eb);
fflush(stdout);
- size = btrfs_level_size(root, btrfs_header_level(eb) - 1);
+ size = root->nodesize;
for (i = 0; i < nr; i++) {
u64 blocknr = btrfs_node_blockptr(eb, i);
btrfs_node_key(eb, &disk_key, i);