Add zpool properties for allocation class space

The existing zpool properties accounting pool space (size, allocated,
fragmentation, expandsize, free, capacity) are based on the normal
metaslab class or are cumulative properties of several classes combined.

Add properties reporting the space accounting metrics for each metaslab
class individually.

Also introduce pool-wide AVAIL, USABLE, and USED properties reporting
values corresponding to FREE, SIZE, and ALLOC deflated for raidz.

Update ZTS to recognize the new properties and validate reported values.

While in zpool_get_parsable.cfg, add "fragmentation" to the list of
parsable properties.

Sponsored-by: Klara, Inc.
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Signed-off-by: Ryan Moeller <ryan.moeller@klarasystems.com>
Cloes #18238
This commit is contained in:
Ryan Moeller
2026-02-18 11:54:13 -05:00
committed by Brian Behlendorf
parent 6ba3f915d0
commit ac0fd40c8c
14 changed files with 1047 additions and 36 deletions
+58 -1
View File
@@ -3372,7 +3372,64 @@
<enumerator name='ZPOOL_PROP_LAST_SCRUBBED_TXG' value='39'/>
<enumerator name='ZPOOL_PROP_DEDUPUSED' value='40'/>
<enumerator name='ZPOOL_PROP_DEDUPSAVED' value='41'/>
<enumerator name='ZPOOL_NUM_PROPS' value='42'/>
<enumerator name='ZPOOL_PROP_AVAILABLE' value='42'/>
<enumerator name='ZPOOL_PROP_USABLE' value='43'/>
<enumerator name='ZPOOL_PROP_USED' value='44'/>
<enumerator name='ZPOOL_PROP_NORMAL_SIZE' value='45'/>
<enumerator name='ZPOOL_PROP_NORMAL_CAPACITY' value='46'/>
<enumerator name='ZPOOL_PROP_NORMAL_FREE' value='47'/>
<enumerator name='ZPOOL_PROP_NORMAL_ALLOCATED' value='48'/>
<enumerator name='ZPOOL_PROP_NORMAL_AVAILABLE' value='49'/>
<enumerator name='ZPOOL_PROP_NORMAL_USABLE' value='50'/>
<enumerator name='ZPOOL_PROP_NORMAL_USED' value='51'/>
<enumerator name='ZPOOL_PROP_NORMAL_EXPANDSZ' value='52'/>
<enumerator name='ZPOOL_PROP_NORMAL_FRAGMENTATION' value='53'/>
<enumerator name='ZPOOL_PROP_SPECIAL_SIZE' value='54'/>
<enumerator name='ZPOOL_PROP_SPECIAL_CAPACITY' value='55'/>
<enumerator name='ZPOOL_PROP_SPECIAL_FREE' value='56'/>
<enumerator name='ZPOOL_PROP_SPECIAL_ALLOCATED' value='57'/>
<enumerator name='ZPOOL_PROP_SPECIAL_AVAILABLE' value='58'/>
<enumerator name='ZPOOL_PROP_SPECIAL_USABLE' value='59'/>
<enumerator name='ZPOOL_PROP_SPECIAL_USED' value='60'/>
<enumerator name='ZPOOL_PROP_SPECIAL_EXPANDSZ' value='61'/>
<enumerator name='ZPOOL_PROP_SPECIAL_FRAGMENTATION' value='62'/>
<enumerator name='ZPOOL_PROP_DEDUP_SIZE' value='63'/>
<enumerator name='ZPOOL_PROP_DEDUP_CAPACITY' value='64'/>
<enumerator name='ZPOOL_PROP_DEDUP_FREE' value='65'/>
<enumerator name='ZPOOL_PROP_DEDUP_ALLOCATED' value='66'/>
<enumerator name='ZPOOL_PROP_DEDUP_AVAILABLE' value='67'/>
<enumerator name='ZPOOL_PROP_DEDUP_USABLE' value='68'/>
<enumerator name='ZPOOL_PROP_DEDUP_USED' value='69'/>
<enumerator name='ZPOOL_PROP_DEDUP_EXPANDSZ' value='70'/>
<enumerator name='ZPOOL_PROP_DEDUP_FRAGMENTATION' value='71'/>
<enumerator name='ZPOOL_PROP_LOG_SIZE' value='72'/>
<enumerator name='ZPOOL_PROP_LOG_CAPACITY' value='73'/>
<enumerator name='ZPOOL_PROP_LOG_FREE' value='74'/>
<enumerator name='ZPOOL_PROP_LOG_ALLOCATED' value='75'/>
<enumerator name='ZPOOL_PROP_LOG_AVAILABLE' value='76'/>
<enumerator name='ZPOOL_PROP_LOG_USABLE' value='77'/>
<enumerator name='ZPOOL_PROP_LOG_USED' value='78'/>
<enumerator name='ZPOOL_PROP_LOG_EXPANDSZ' value='79'/>
<enumerator name='ZPOOL_PROP_LOG_FRAGMENTATION' value='80'/>
<enumerator name='ZPOOL_PROP_ELOG_SIZE' value='81'/>
<enumerator name='ZPOOL_PROP_ELOG_CAPACITY' value='82'/>
<enumerator name='ZPOOL_PROP_ELOG_FREE' value='83'/>
<enumerator name='ZPOOL_PROP_ELOG_ALLOCATED' value='84'/>
<enumerator name='ZPOOL_PROP_ELOG_AVAILABLE' value='85'/>
<enumerator name='ZPOOL_PROP_ELOG_USABLE' value='86'/>
<enumerator name='ZPOOL_PROP_ELOG_USED' value='87'/>
<enumerator name='ZPOOL_PROP_ELOG_EXPANDSZ' value='88'/>
<enumerator name='ZPOOL_PROP_ELOG_FRAGMENTATION' value='89'/>
<enumerator name='ZPOOL_PROP_SELOG_SIZE' value='90'/>
<enumerator name='ZPOOL_PROP_SELOG_CAPACITY' value='91'/>
<enumerator name='ZPOOL_PROP_SELOG_FREE' value='92'/>
<enumerator name='ZPOOL_PROP_SELOG_ALLOCATED' value='93'/>
<enumerator name='ZPOOL_PROP_SELOG_AVAILABLE' value='94'/>
<enumerator name='ZPOOL_PROP_SELOG_USABLE' value='95'/>
<enumerator name='ZPOOL_PROP_SELOG_USED' value='96'/>
<enumerator name='ZPOOL_PROP_SELOG_EXPANDSZ' value='97'/>
<enumerator name='ZPOOL_PROP_SELOG_FRAGMENTATION' value='98'/>
<enumerator name='ZPOOL_NUM_PROPS' value='99'/>
</enum-decl>
<typedef-decl name='zpool_prop_t' type-id='af1ba157' id='5d0c23fb'/>
<typedef-decl name='regoff_t' type-id='95e97e5e' id='54a2a2a8'/>
+58 -1
View File
@@ -370,8 +370,47 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf,
zfs_fallthrough;
case ZPOOL_PROP_SIZE:
case ZPOOL_PROP_NORMAL_SIZE:
case ZPOOL_PROP_SPECIAL_SIZE:
case ZPOOL_PROP_DEDUP_SIZE:
case ZPOOL_PROP_LOG_SIZE:
case ZPOOL_PROP_ELOG_SIZE:
case ZPOOL_PROP_SELOG_SIZE:
case ZPOOL_PROP_ALLOCATED:
case ZPOOL_PROP_NORMAL_ALLOCATED:
case ZPOOL_PROP_SPECIAL_ALLOCATED:
case ZPOOL_PROP_DEDUP_ALLOCATED:
case ZPOOL_PROP_LOG_ALLOCATED:
case ZPOOL_PROP_ELOG_ALLOCATED:
case ZPOOL_PROP_SELOG_ALLOCATED:
case ZPOOL_PROP_AVAILABLE:
case ZPOOL_PROP_NORMAL_AVAILABLE:
case ZPOOL_PROP_SPECIAL_AVAILABLE:
case ZPOOL_PROP_DEDUP_AVAILABLE:
case ZPOOL_PROP_LOG_AVAILABLE:
case ZPOOL_PROP_ELOG_AVAILABLE:
case ZPOOL_PROP_SELOG_AVAILABLE:
case ZPOOL_PROP_FREE:
case ZPOOL_PROP_NORMAL_FREE:
case ZPOOL_PROP_SPECIAL_FREE:
case ZPOOL_PROP_DEDUP_FREE:
case ZPOOL_PROP_LOG_FREE:
case ZPOOL_PROP_ELOG_FREE:
case ZPOOL_PROP_SELOG_FREE:
case ZPOOL_PROP_USABLE:
case ZPOOL_PROP_NORMAL_USABLE:
case ZPOOL_PROP_SPECIAL_USABLE:
case ZPOOL_PROP_DEDUP_USABLE:
case ZPOOL_PROP_LOG_USABLE:
case ZPOOL_PROP_ELOG_USABLE:
case ZPOOL_PROP_SELOG_USABLE:
case ZPOOL_PROP_USED:
case ZPOOL_PROP_NORMAL_USED:
case ZPOOL_PROP_SPECIAL_USED:
case ZPOOL_PROP_DEDUP_USED:
case ZPOOL_PROP_LOG_USED:
case ZPOOL_PROP_ELOG_USED:
case ZPOOL_PROP_SELOG_USED:
case ZPOOL_PROP_FREEING:
case ZPOOL_PROP_LEAKED:
case ZPOOL_PROP_ASHIFT:
@@ -391,6 +430,12 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf,
break;
case ZPOOL_PROP_EXPANDSZ:
case ZPOOL_PROP_NORMAL_EXPANDSZ:
case ZPOOL_PROP_SPECIAL_EXPANDSZ:
case ZPOOL_PROP_DEDUP_EXPANDSZ:
case ZPOOL_PROP_LOG_EXPANDSZ:
case ZPOOL_PROP_ELOG_EXPANDSZ:
case ZPOOL_PROP_SELOG_EXPANDSZ:
case ZPOOL_PROP_CHECKPOINT:
if (intval == 0) {
(void) strlcpy(buf, "-", len);
@@ -403,6 +448,12 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf,
break;
case ZPOOL_PROP_CAPACITY:
case ZPOOL_PROP_NORMAL_CAPACITY:
case ZPOOL_PROP_SPECIAL_CAPACITY:
case ZPOOL_PROP_DEDUP_CAPACITY:
case ZPOOL_PROP_LOG_CAPACITY:
case ZPOOL_PROP_ELOG_CAPACITY:
case ZPOOL_PROP_SELOG_CAPACITY:
if (literal) {
(void) snprintf(buf, len, "%llu",
(u_longlong_t)intval);
@@ -413,7 +464,13 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf,
break;
case ZPOOL_PROP_FRAGMENTATION:
if (intval == UINT64_MAX) {
case ZPOOL_PROP_NORMAL_FRAGMENTATION:
case ZPOOL_PROP_SPECIAL_FRAGMENTATION:
case ZPOOL_PROP_DEDUP_FRAGMENTATION:
case ZPOOL_PROP_LOG_FRAGMENTATION:
case ZPOOL_PROP_ELOG_FRAGMENTATION:
case ZPOOL_PROP_SELOG_FRAGMENTATION:
if (intval == ZFS_FRAG_INVALID) {
(void) strlcpy(buf, "-", len);
} else if (literal) {
(void) snprintf(buf, len, "%llu",