Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Values printed by zpool-iostat(8) should be right-aligned #14751

Merged
merged 1 commit into from
Apr 18, 2023

Conversation

Low-power
Copy link
Contributor

Motivation and Context

Fix #14749.

Description

See the title and #14749.

How Has This Been Tested?

Tested locally.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

This inappropriate left-alignment was introduced in 7bb7b1f.

Signed-off-by: WHR <msl0000023508@gmail.com>
Copy link
Contributor

@mcmilk mcmilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this fast response and fix @Low-power.

{
fputs(" ", stdout);
size_t len = strlen(statbuf);
while (len < column_size) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a new line before the while() .... but this is cosmetic ;)

if (*statbuf == '0') {
color_start(ANSI_GRAY);
fputc('0', stdout);
column_size--;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding color_end(); and return; here ....
And we can put the whole for() loop a tab to the left.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. May be we can do these code cleanups later.
Now I also feels that the series of else if inside for should probably be turned into a switch instead for readability.

@ahrens
Copy link
Member

ahrens commented Apr 16, 2023

@Low-power thanks!

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Apr 17, 2023
Copy link
Contributor

@tonyhutter tonyhutter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this PR manually and verified it fixes the column alignment.

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Apr 18, 2023
@behlendorf behlendorf merged commit f9e1c63 into openzfs:master Apr 18, 2023
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Apr 18, 2023
This inappropriate left-alignment was introduced in 7bb7b1f.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: WHR <msl0000023508@gmail.com>
Closes openzfs#14751
ixhamza pushed a commit to truenas/zfs that referenced this pull request Apr 20, 2023
This inappropriate left-alignment was introduced in 7bb7b1f.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: WHR <msl0000023508@gmail.com>
Closes openzfs#14751
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Apr 30, 2023
This inappropriate left-alignment was introduced in 7bb7b1f.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: WHR <msl0000023508@gmail.com>
Closes openzfs#14751
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

zpool iostat columns are misaligned
5 participants