Message ID | 59f60b49-3e74-547d-5124-8ce0097059ff@applied-asynchrony.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Sat, Sep 30, 2017 at 05:54:27PM +0200, Holger Hoffstätte wrote: > > The values for block group offset, length etc. in btrfs-debugfs' output > are left-aligned, which creates unaligned output and makes the usage > percentage hard to read/process further. This patch adds right-aligning > format specifiers for the number values. > Ideally the format values wouldn't be hardcoded but instead derived from > the filesystem size, but this seems to work for now. > > Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com> Applied, thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/btrfs-debugfs b/btrfs-debugfs index dfb88539..a7ecd16d 100755 --- a/btrfs-debugfs +++ b/btrfs-debugfs @@ -356,8 +356,13 @@ def print_block_groups(mountpoint): ctypes.memmove(ctypes.addressof(bg), p, ctypes.sizeof(bg)) if bg.flags & BTRFS_BLOCK_GROUP_DATA: - print "block group offset %Lu len %Lu used %Lu chunk_objectid %Lu flags %Lu usage %.2f" %\ - (header.objectid, header.offset, bg.used, bg.chunk_objectid, bg.flags, float(bg.used) / float(header.offset)) + print "block group offset %s len %s used %s chunk_objectid %Lu flags %Lu usage %.2f" %\ + ('{:>14}'.format(header.objectid), + '{:>10}'.format(header.offset), + '{:>10}'.format(bg.used), + bg.chunk_objectid, + bg.flags, + float(bg.used) / float(header.offset)) total_free += (header.offset - bg.used) if min_used >= bg.used:
The values for block group offset, length etc. in btrfs-debugfs' output are left-aligned, which creates unaligned output and makes the usage percentage hard to read/process further. This patch adds right-aligning format specifiers for the number values. Ideally the format values wouldn't be hardcoded but instead derived from the filesystem size, but this seems to work for now. Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com> --- btrfs-debugfs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)