From: Wang Xiaoguang <[email protected]>

Signed-off-by: Wang Xiaoguang <[email protected]>
---
 print-tree.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/print-tree.c b/print-tree.c
index 53a6813..5727cb9 100644
--- a/print-tree.c
+++ b/print-tree.c
@@ -286,6 +286,20 @@ static void print_uuids(struct extent_buffer *eb)
        printf("fs uuid %s\nchunk uuid %s\n", fs_uuid, chunk_uuid);
 }
 
+static char *compress_flags_to_str(u8 flag)
+{
+       switch (flag) {
+       case BTRFS_COMPRESS_NONE:
+               return "none";
+       case BTRFS_COMPRESS_ZLIB:
+               return "zlib";
+       case BTRFS_COMPRESS_LZO:
+               return "lzo";
+       default:
+               return "UNKNOWN";
+       }
+}
+
 static void print_file_extent_item(struct extent_buffer *eb,
                                   struct btrfs_item *item,
                                   int slot,
@@ -295,10 +309,10 @@ static void print_file_extent_item(struct extent_buffer 
*eb,
 
        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_flags_to_str(btrfs_file_extent_compression(eb, fi)));
                return;
        }
        if (extent_type == BTRFS_FILE_EXTENT_PREALLOC) {
@@ -317,8 +331,8 @@ 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_flags_to_str(btrfs_file_extent_compression(eb, fi)));
 }
 
 /* Caller should ensure sizeof(*ret) >= 16("DATA|TREE_BLOCK") */
-- 
1.8.3.1



--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to