-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Make zpool status dedup table support raw bytes -p output #17926
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
base: master
Are you sure you want to change the base?
Conversation
470a20d to
e05bd74
Compare
e05bd74 to
1d3713c
Compare
449d460 to
7ddd5b0
Compare
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(). Signed-off-by: Adi Gollamudi <[email protected]> Fixes openzfs#11626
Boolean_t paramater "parsable" was added to zpool_dump_ddt(). This updates ABI files accordingly. Signed-off-by: Adi Gollamudi <[email protected]>
7ddd5b0 to
99578b7
Compare
|
@amotin @behlendorf No worries if there are more pressing reviews going on right now, but I just wanted to follow up on this. |
| fmt_num(parsable, dds->dds_ref_blocks, ref_blocks, sizeof (ref_blocks)); | ||
| fmt_bytes(parsable, dds->dds_ref_lsize, ref_lsize, sizeof (ref_lsize)); | ||
| fmt_bytes(parsable, dds->dds_ref_psize, ref_psize, sizeof (ref_psize)); | ||
| fmt_bytes(parsable, dds->dds_ref_dsize, ref_dsize, sizeof (ref_dsize)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to use the existing zfs_nicenum_format() function here and either specify the ZFS_NICENUM_BYTES or ZFS_NICENUM_RAW for the formatting.
| (void) printf("%s: object=%llu\n", name, | ||
| (u_longlong_t)ddt->ddt_object[type][class]); | ||
| zpool_dump_ddt(NULL, &ddt->ddt_histogram[type][class]); | ||
| zpool_dump_ddt(NULL, &ddt->ddt_histogram[type][class], B_TRUE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to honor the -P / --parseable flag here and below. Something like:
zpool_dump_ddt(NULL, &ddt->ddt_histogram[type][class], dump_opt['P'] > 0);
Check if
-pflag is enabled, and if so print dedup table with raw bytes. Restructure the logic in zutil_pool to check if-pflag is enabled before callingzfs_nicenum()andzfs_nicebytes(). Other files changed update the call to/header declaration ofdump_ddt_stat()to include a new variable: boolean_t parsable, indicating whether or not-pwas usedThis 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
-pflag was used.Fixes #11626
How Has This Been Tested?
Before this PR, when
-pwasn'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.6MAfter 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 41549Types of changes
Checklist:
Signed-off-by.