zfs icon indicating copy to clipboard operation
zfs copied to clipboard

Make zpool status dedup table support raw bytes -p output

Open Adi-Goll opened this issue 1 month ago • 1 comments

Check if -p flag is enabled, and if so print dedup table with raw bytes. Restructure the logic in zutil_pool to check if -p flag is enabled before calling zfs_nicenum() and zfs_nicebytes(). Other files changed update the call to/header declaration of dump_ddt_stat() to include a new variable: boolean_t parsable, indicating whether or not -p was used

This PR also includes updates to the ABI files because the function header for zpool_dump_ddt() was modified to include a new parameter which indicates if the -p flag was used.

Fixes #11626

How Has This Been Tested?

Before this PR, when -p wasn't supported (equivalent of running the command with just -D):

zpool status -D -p testpool
  pool: testpool
 state: ONLINE
config:

	NAME                       STATE     READ WRITE CKSUM
	testpool                   ONLINE       0     0     0
	  mirror-0                 ONLINE       0     0     0
	    /tmp/zdisks/disk1.img  ONLINE       0     0     0
	    /tmp/zdisks/disk2.img  ONLINE       0     0     0

errors: No known data errors

 dedup: DDT entries 317, size 118K on disk, 96K in core

bucket              allocated                       referenced
______   ______________________________   ______________________________
refcnt   blocks   LSIZE   PSIZE   DSIZE   blocks   LSIZE   PSIZE   DSIZE
------   ------   -----   -----   -----   ------   -----   -----   -----
     1      317   39.6M   39.6M   39.6M      317   39.6M   39.6M   39.6M
 Total      317   39.6M   39.6M   39.6M      317   39.6M   39.6M   39.6M

After this PR:

zpool status -D -p testpool
  pool: testpool
 state: ONLINE
config:

	NAME                       STATE     READ WRITE CKSUM
	testpool                   ONLINE       0     0     0
	  mirror-0                 ONLINE       0     0     0
	    /tmp/zdisks/disk1.img  ONLINE       0     0     0
	    /tmp/zdisks/disk2.img  ONLINE       0     0     0

errors: No known data errors

 dedup: DDT entries 317, size 121344 on disk, 98304 in core

bucket              allocated                       referenced
______   ______________________________   ______________________________
refcnt   blocks   LSIZE   PSIZE   DSIZE   blocks   LSIZE   PSIZE   DSIZE
------   ------   -----   -----   -----   ------   -----   -----   -----
     1      317   41549   41549   41549      317   41549   41549   41549
 Total      317   41549   41549   41549      317   41549   41549   41549

Types of changes

  • [x] 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)
  • [x] Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • [ ] Documentation (a change to man pages or other documentation)

Checklist:

  • [x] My code follows the OpenZFS code style requirements.
  • [ ] I have updated the documentation accordingly.
  • [x] I have read the contributing document.
  • [ ] I have added tests to cover my changes.
  • [x] I have run the ZFS Test Suite with this change applied.
  • [x] All commit messages are properly formatted and contain Signed-off-by.

Adi-Goll avatar Nov 11 '25 22:11 Adi-Goll

@amotin @behlendorf No worries if there are more pressing reviews going on right now, but I just wanted to follow up on this.

Adi-Goll avatar Dec 03 '25 06:12 Adi-Goll