From: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Cc: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
Subject: [PATCH] btrfs-progs: btrfs-debug-tree: show the compression method string
Date: Thu, 10 Mar 2016 16:40:39 +0800 [thread overview]
Message-ID: <1457599239-5512-1-git-send-email-wangxg.fnst@cn.fujitsu.com> (raw)
From: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
---
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
next reply other threads:[~2016-03-10 9:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-10 8:40 Xiaoguang Wang [this message]
2016-03-10 13:23 ` [PATCH] btrfs-progs: btrfs-debug-tree: show the compression method string David Sterba
2016-03-11 3:08 ` Xiaoguang Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1457599239-5512-1-git-send-email-wangxg.fnst@cn.fujitsu.com \
--to=wangxg.fnst@cn.fujitsu.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).