btrfs-progs: device: print num_stripes in usage command
PATCH 1/1 btrfs-progs: device: print num_stripes in usage command
This patch appends num_stripes for each chunks in device usage commands. It helps to see profiles easily. The output is like below.
/dev/vdb, ID: 1
Device size: 1.00GiB
Device slack: 0.00B
Data,single[1]: 120.00MiB
Metadata,DUP[2]: 102.38MiB
System,DUP[2]: 16.00MiB
Unallocated: 785.62MiB
--- cmds/filesystem-usage.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
cmds/filesystem-usage.c +6 -2
@@ -1192,6 +1192,7 @@ void print_device_chunks(struct device_info *devinfo,const char *r_mode;u64 flags;u64 size; +u64 num_stripes;if (chunks_info_ptr[i].devid != devinfo->devid)continue ;
@@ -1201,10 +1202,13 @@ void print_device_chunks(struct device_info *devinfo, description =btrfs_group_type_str (flags); r_mode =btrfs_group_profile_str (flags); size =calc_chunk_size (chunks_info_ptr+i); -printf (" %s,%s:%*s%10s\n" , + num_stripes = chunks_info_ptr[i].num_stripes; +printf (" %s,%s[%llu]:%*s%10s\n" , description, r_mode, - (int )(20 -strlen (description) -strlen (r_mode)),"" , + num_stripes, + (int )(20 -strlen (description) -strlen (r_mode) + -count_digits (num_stripes) -2 ),"" ,pretty_size_mode (size, unit_mode)); allocated += size;
Signature · 1 line
2.25.1
Quoted 10 lines · Sidong Yang
This patch appends
num_stripesfor each chunks in device usage commands. It helps to see profiles easily. The output is like below.
/dev/vdb, ID: 1
Device size: 1.00GiB
Device slack: 0.00B
Data,single[1]: 120.00MiB
Metadata,DUP[2]: 102.38MiB
System,DUP[2]: 16.00MiB
Unallocated: 785.62MiB
This is example of single and dup, but the whole point was to print that for the striped profiles, like is shown in the issue
https://github.com/kdave/btrfs-progs/issues/372 , so it needs to be conditional.
As the mirrored profiles have a fixed number of copies, there's no doubt on how many devices are printed, same for single and dup.
I'm more inclined to use the "/" as separator: 'RAID6/3' it's more like "raid6 on three devices", the "[]" looks like indexing. "," is used as separator of the type so it won't be as simple to parse that.
Quoted 4 lines · David Sterba
Quoted 3 lines · Sidong Yang
This patch appends
num_stripesfor each chunks in device usage commands. It helps to see profiles easily. The output is like below.
Quoted 8 lines
Quoted 7 lines
/dev/vdb, ID: 1
Device size: 1.00GiB
Device slack: 0.00B
Data,single[1]: 120.00MiB
Metadata,DUP[2]: 102.38MiB
System,DUP[2]: 16.00MiB
Unallocated: 785.62MiB
Hi David. Thanks for review!
Quoted 4 lines
This is example of single and dup, but the whole point was to print that for the striped profiles, like is shown in the issue
https://github.com/kdave/btrfs-progs/issues/372 , so it needs to be conditional.
Okay, striped profiles need to be printed. I read some page from wikipedia about raid. and I got that RAID 0,5,6,10 supports striping. Those need to be printed and no printing for RAID 1, single, dup.
Quoted 7 lines
As the mirrored profiles have a fixed number of copies, there's no doubt on how many devices are printed, same for single and dup.
I'm more inclined to use the "/" as separator: 'RAID6/3' it's more like "raid6 on three devices", the "[]" looks like indexing. "," is used as separator of the type so it won't be as simple to parse that.
I agree. I'll use "/" for next version.