* [PATCH] btrfs-progs: btrfs-debug-tree: show the compression method string
@ 2016-03-10 8:40 Xiaoguang Wang
2016-03-10 13:23 ` David Sterba
0 siblings, 1 reply; 3+ messages in thread
From: Xiaoguang Wang @ 2016-03-10 8:40 UTC (permalink / raw)
To: linux-btrfs; +Cc: Wang Xiaoguang
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: btrfs-debug-tree: show the compression method string
2016-03-10 8:40 [PATCH] btrfs-progs: btrfs-debug-tree: show the compression method string Xiaoguang Wang
@ 2016-03-10 13:23 ` David Sterba
2016-03-11 3:08 ` Xiaoguang Wang
0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2016-03-10 13:23 UTC (permalink / raw)
To: Xiaoguang Wang; +Cc: linux-btrfs
On Thu, Mar 10, 2016 at 04:40:39PM +0800, Xiaoguang Wang wrote:
> 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";
would be good to print the actual value
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: btrfs-debug-tree: show the compression method string
2016-03-10 13:23 ` David Sterba
@ 2016-03-11 3:08 ` Xiaoguang Wang
0 siblings, 0 replies; 3+ messages in thread
From: Xiaoguang Wang @ 2016-03-11 3:08 UTC (permalink / raw)
To: dsterba, linux-btrfs
hello,
On 03/10/2016 09:23 PM, David Sterba wrote:
> On Thu, Mar 10, 2016 at 04:40:39PM +0800, Xiaoguang Wang wrote:
>> 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";
>
> would be good to print the actual value
OK, new version will be sent soon.
Regards,
Xiaoguang Wang
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-11 3:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-10 8:40 [PATCH] btrfs-progs: btrfs-debug-tree: show the compression method string Xiaoguang Wang
2016-03-10 13:23 ` David Sterba
2016-03-11 3:08 ` Xiaoguang Wang
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).