Skip to content

Conversation

Shreshth3
Copy link
Contributor

@Shreshth3 Shreshth3 commented Oct 11, 2025

Fixes #11040.

Right now, the -v and -o options for zpool list work independently, but when paired, the -v "wins out" and the -o effect is lost. This commit fixes that problem.

Before my change:
(master) ~/zfs$ ./zpool list -v -o name,health mypool
NAME          HEALTH
mypool        ONLINE
  mirror-0   960M   110K   960M        -         -     2%  0.01%      -    ONLINE
    loop17     1G      -      -        -         -      -      -      -    ONLINE
    loop18     1G      -      -        -         -      -      -      -    ONLINE
After my change:
(v-o-option-conflict) ~/zfs$ ./zpool list -v -o name,health mypool
NAME          HEALTH
mypool        ONLINE
  mirror-0    ONLINE
    loop17    ONLINE
    loop18    ONLINE

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)
  • Quality assurance (non-breaking change which makes the code more robust against bugs)
  • 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:

@github-actions github-actions bot added the Status: Work in Progress Not yet ready for general review label Oct 11, 2025
@Shreshth3 Shreshth3 marked this pull request as ready for review October 11, 2025 07:29
@github-actions github-actions bot added Status: Code Review Needed Ready for review and testing and removed Status: Work in Progress Not yet ready for general review labels Oct 11, 2025
Copy link
Member

@robn robn left a comment

Choose a reason for hiding this comment

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

Nice straightforward fix, good job!

@Shreshth3 Shreshth3 force-pushed the v-o-option-conflict branch from 0ed555e to 4c1785c Compare October 17, 2025 04:29
Copy link
Contributor Author

@Shreshth3 Shreshth3 left a comment

Choose a reason for hiding this comment

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

I believe I made the necessary changes.

Copy link
Member

@amotin amotin left a comment

Choose a reason for hiding this comment

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

Looking closer, while it does look like a step in a right direction, I think we should go further now. For example, dedup field has nothing to do with vdevs, but it is present in this code. Same time bclone_ratio absent here is not printed properly:

mav@genoa2:~# zpool list -v -o name,dedup,bclone_ratio,health optane
NAME       DEDUP  BCLONE_RATIO    HEALTH
optane     1.00x         1.00x    ONLINE
  nvd0p1       -    ONLINE
  nvd10p1      -    ONLINE
  nvd11p1      -    ONLINE
  nvd12p1      -    ONLINE
  nvd13p1      -    ONLINE
  nvd1p1       -    ONLINE
  nvd2p1       -    ONLINE
  nvd3p1       -    ONLINE
  nvd4p1       -    ONLINE
  nvd5p1       -    ONLINE
  nvd6p1       -    ONLINE
  nvd7p1       -    ONLINE
  nvd8p1       -    ONLINE
  nvd9p1       -    ONLINE

Can we remove explicit mention of not applicable properties, but instead handle them all universally?

@Shreshth3 Shreshth3 force-pushed the v-o-option-conflict branch from 4c1785c to 02e874b Compare October 20, 2025 00:11
@Shreshth3
Copy link
Contributor Author

Shreshth3 commented Oct 20, 2025

@amotin Made that change. Here is the new output:

(v-o-option-conflict) ~/zfs$ ./zpool list -v -o name,dedup,bclone_ratio,health mypool
NAME       DEDUP  BCLONE_RATIO    HEALTH
mypool     1.00x         1.00x    ONLINE
  loop17       -             0    ONLINE
  loop18       -             0    ONLINE
  loop19       -             0    ONLINE

Note: the only "not applicable property" I explicitly removed was dedup. I looked through the other explicitly mentioned properties, and I believe they are all applicable, though I'm not 100% sure. Let me know if I missed any.

Fixes openzfs#11040.

Right now, the -v and -o options for `zpool list`
work independently, but when paired, the -v
"wins out" and the -o effect is lost. This
commit fixes that problem.

Signed-off-by: Shreshth Srivastava <[email protected]>
@Shreshth3 Shreshth3 force-pushed the v-o-option-conflict branch from 02e874b to 0b44613 Compare October 20, 2025 18:14
Copy link
Member

@amotin amotin left a comment

Choose a reason for hiding this comment

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

Thanks.

BTW, I have feeling that bclone_ratio may actually be applicable to top-level vdevs, since that is where BRT works. But unless it is trivial, it might be too far out of this PR scope.

@Shreshth3
Copy link
Contributor Author

I took a look at adding bclone_ratio to be shown properly for top-level vdevs. I'm happy to make that change, but I do think it would be better to do that in a separate PR.

@amotin amotin added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Oct 21, 2025
@behlendorf behlendorf merged commit 4470461 into openzfs:master Oct 21, 2025
22 of 25 checks passed
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 list -v disregards other options

4 participants