Skip to content

Make zpool status dedup table support raw bytes -p output#17926

Open
Adi-Goll wants to merge 2 commits intoopenzfs:masterfrom
Adi-Goll:adding-pflag-for-ddt-dump
Open

Make zpool status dedup table support raw bytes -p output#17926
Adi-Goll wants to merge 2 commits intoopenzfs:masterfrom
Adi-Goll:adding-pflag-for-ddt-dump

Conversation

@Adi-Goll
Copy link
Contributor

@Adi-Goll Adi-Goll commented Nov 11, 2025

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 making calls to zfs_nicenum_format(). 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.

No changes were made to the printing of the DDT, however to ensure that when the raw bytes were printed and not truncated, the buffer size storing the table values was increased to 32 bytes.

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):

$ sudo zpool status -D -p tank
  pool: tank
 state: ONLINE
config:

	NAME             STATE     READ WRITE CKSUM
	tank             ONLINE       0     0     0
	  /tmp/disk.img  ONLINE       0     0     0

errors: No known data errors

 dedup: DDT entries 1, size 3K on disk, 8K in core

bucket              allocated                       referenced
______   ______________________________   ______________________________
refcnt   blocks   LSIZE   PSIZE   DSIZE   blocks   LSIZE   PSIZE   DSIZE
------   ------   -----   -----   -----   ------   -----   -----   -----
    2K        1    128K    128K    128K    3.12K    400M    400M    400M
 Total        1    128K    128K    128K    3.12K    400M    400M    400M

After this PR:

$ zpool status -D -p tank
  pool: tank
 state: ONLINE
config:

	NAME             STATE     READ WRITE CKSUM
	tank             ONLINE       0     0     0
	  /tmp/disk.img  ONLINE       0     0     0

errors: No known data errors

 dedup: DDT entries 1, size 3072 on disk, 8192 in core

bucket           allocated                       referenced
____________________________________   ______________________________
refcnt   blocks   LSIZE   PSIZE   DSIZE   blocks   LSIZE   PSIZE   DSIZE
------   ------   -----   -----   -----   ------   -----   -----   -----
  2048        1   131072   131072   131072     3200   419430400   419430400   419430400
 Total        1   131072   131072   131072     3200   419430400   419430400   419430400

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:

@Adi-Goll Adi-Goll marked this pull request as draft November 13, 2025 18:10
@github-actions github-actions bot added the Status: Work in Progress Not yet ready for general review label Nov 13, 2025
@Adi-Goll Adi-Goll force-pushed the adding-pflag-for-ddt-dump branch 2 times, most recently from 470a20d to e05bd74 Compare November 16, 2025 08:22
@Adi-Goll Adi-Goll marked this pull request as ready for review November 16, 2025 08:25
@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 Nov 16, 2025
@Adi-Goll Adi-Goll marked this pull request as draft November 16, 2025 08:27
@github-actions github-actions bot added Status: Work in Progress Not yet ready for general review and removed Status: Code Review Needed Ready for review and testing labels Nov 16, 2025
@Adi-Goll Adi-Goll force-pushed the adding-pflag-for-ddt-dump branch from e05bd74 to 1d3713c Compare November 16, 2025 08:44
@Adi-Goll Adi-Goll marked this pull request as ready for review November 16, 2025 08:45
@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 Nov 16, 2025
@Adi-Goll Adi-Goll force-pushed the adding-pflag-for-ddt-dump branch 3 times, most recently from 7ddd5b0 to 99578b7 Compare November 18, 2025 02:59
@Adi-Goll Adi-Goll marked this pull request as draft November 19, 2025 07:12
@github-actions github-actions bot added Status: Work in Progress Not yet ready for general review and removed Status: Code Review Needed Ready for review and testing labels Nov 19, 2025
@Adi-Goll Adi-Goll marked this pull request as ready for review November 19, 2025 09:41
@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 Nov 19, 2025
@Adi-Goll
Copy link
Contributor Author

Adi-Goll commented Dec 3, 2025

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

verify(nvlist_lookup_uint64_array(config, ZPOOL_CONFIG_DDT_HISTOGRAM,
(uint64_t **)&ddh, &c) == 0);
zpool_dump_ddt(dds, ddh);
zpool_dump_ddt(dds, ddh, literal);
Copy link
Contributor Author

@Adi-Goll Adi-Goll Dec 21, 2025

Choose a reason for hiding this comment

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

it may still be preferrable to do dump_opt['P'] > 0 here but I'm not sure. The value for literal seems to correspond to cb.cb_literal, which is set to B_TRUE when checking for a p option being enabled, on line 11250 of this file, so this seems to be correct from what I see but let me know if you have thoughts!

@Adi-Goll Adi-Goll force-pushed the adding-pflag-for-ddt-dump branch 4 times, most recently from 7a18ad3 to 68efee8 Compare December 21, 2025 05:51
@Adi-Goll Adi-Goll requested a review from behlendorf December 21, 2025 06:36
@Adi-Goll Adi-Goll force-pushed the adding-pflag-for-ddt-dump branch 2 times, most recently from 72ca6c9 to 1da4b7e Compare December 26, 2025 16:48
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 printing either the bytes or raw numbers.

Calls to print the data for DDT now all use
zfs_nicenum_format(). Increased DDT histogram column buffers
to 32 bytes to prevent truncation when -p is enabled.

Signed-off-by: Adi Gollamudi <adigollamudi@gmail.com>
Fixes openzfs#11626
Boolean_t paramater "parsable" was added to zpool_dump_ddt(). This
updates ABI files accordingly.

Signed-off-by: Adi Gollamudi <adigollamudi@gmail.com>
@Adi-Goll Adi-Goll force-pushed the adding-pflag-for-ddt-dump branch from 1da4b7e to 63fa777 Compare December 26, 2025 17:05
@Adi-Goll Adi-Goll requested a review from amotin December 26, 2025 18:47
alek-p added a commit to alek-p/openzfs that referenced this pull request Jan 12, 2026
- Added '-E' flag to 'zpool status' to exclude specific pools from output.
- Added '-p' support to 'zpool status -D' to display raw deduplication statistics.
- Updated ABI and internal functions to support the new 'literal' argument for dedup stats.
- Added regression test 'zpool_status_009_pos.ksh' to verify both new features.

This change addresses openzfs issues openzfs#17902 and openzfs#17926.
Implemented by Gemini.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Code Review Needed Ready for review and testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zpool status -D dedup table does not support raw bytes -p output

3 participants