mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
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:
committed by
Brian Behlendorf
parent
6ba3f915d0
commit
ac0fd40c8c
@@ -50,6 +50,41 @@ zpool_prop_get_table(void)
|
||||
return (zpool_prop_table);
|
||||
}
|
||||
|
||||
/* BEGIN CSTYLED */
|
||||
#define zprop_register_mc_props_impl(mcp, uprefix, lprefix, sfeatures) ({ \
|
||||
zprop_register_number(mcp + ZPOOL_MC_PROP_SIZE, \
|
||||
#lprefix "_size", 0, PROP_READONLY, ZFS_TYPE_POOL, "<size>", \
|
||||
#uprefix "_SIZE", B_FALSE, sfeatures); \
|
||||
zprop_register_number(mcp + ZPOOL_MC_PROP_CAPACITY, \
|
||||
#lprefix "_capacity", 0, PROP_READONLY, ZFS_TYPE_POOL, \
|
||||
"<percent>", #uprefix "_CAP", B_FALSE, sfeatures); \
|
||||
zprop_register_number(mcp + ZPOOL_MC_PROP_FREE, \
|
||||
#lprefix "_free", 0, PROP_READONLY, ZFS_TYPE_POOL, "<size>", \
|
||||
#uprefix "_FREE", B_FALSE, sfeatures); \
|
||||
zprop_register_number(mcp + ZPOOL_MC_PROP_ALLOCATED, \
|
||||
#lprefix "_allocated", 0, PROP_READONLY, ZFS_TYPE_POOL, "<size>", \
|
||||
#uprefix "_ALLOC", B_FALSE, sfeatures); \
|
||||
zprop_register_number(mcp + ZPOOL_MC_PROP_AVAILABLE, \
|
||||
#lprefix "_available", 0, PROP_READONLY, ZFS_TYPE_POOL, "<size>", \
|
||||
#uprefix "_AVAIL", B_FALSE, sfeatures); \
|
||||
zprop_register_number(mcp + ZPOOL_MC_PROP_USABLE, \
|
||||
#lprefix "_usable", 0, PROP_READONLY, ZFS_TYPE_POOL, "<size>", \
|
||||
#uprefix "_USABLE", B_FALSE, sfeatures); \
|
||||
zprop_register_number(mcp + ZPOOL_MC_PROP_USED, \
|
||||
#lprefix "_used", 0, PROP_READONLY, ZFS_TYPE_POOL, "<size>", \
|
||||
#uprefix "_USED", B_FALSE, sfeatures); \
|
||||
zprop_register_number(mcp + ZPOOL_MC_PROP_EXPANDSZ, \
|
||||
#lprefix "_expandsize", 0, PROP_READONLY, ZFS_TYPE_POOL, "<size>", \
|
||||
#uprefix "_EXPANDSZ", B_FALSE, sfeatures); \
|
||||
zprop_register_number(mcp + ZPOOL_MC_PROP_FRAGMENTATION, \
|
||||
#lprefix "_fragmentation", 0, PROP_READONLY, ZFS_TYPE_POOL, \
|
||||
"<percent>", #uprefix "_FRAG", B_FALSE, sfeatures); \
|
||||
})
|
||||
#define zprop_register_mc_props(uclass, lclass, sfeatures) \
|
||||
zprop_register_mc_props_impl(ZPOOL_MC_PROPS_##uclass, \
|
||||
CLASS_##uclass, class_##lclass, sfeatures)
|
||||
/* END CSTYLED */
|
||||
|
||||
void
|
||||
zpool_prop_init(void)
|
||||
{
|
||||
@@ -138,6 +173,20 @@ zpool_prop_init(void)
|
||||
zprop_register_number(ZPOOL_PROP_LAST_SCRUBBED_TXG,
|
||||
"last_scrubbed_txg", 0, PROP_READONLY, ZFS_TYPE_POOL, "<txg>",
|
||||
"LAST_SCRUBBED_TXG", B_FALSE, sfeatures);
|
||||
zprop_register_number(ZPOOL_PROP_AVAILABLE, "available", 0,
|
||||
PROP_READONLY, ZFS_TYPE_POOL, "<size>", "AVAIL", B_FALSE,
|
||||
sfeatures);
|
||||
zprop_register_number(ZPOOL_PROP_USABLE, "usable", 0, PROP_READONLY,
|
||||
ZFS_TYPE_POOL, "<size>", "USABLE", B_FALSE, sfeatures);
|
||||
zprop_register_number(ZPOOL_PROP_USED, "used", 0, PROP_READONLY,
|
||||
ZFS_TYPE_POOL, "<size>", "USED", B_FALSE, sfeatures);
|
||||
|
||||
zprop_register_mc_props(NORMAL, normal, sfeatures);
|
||||
zprop_register_mc_props(SPECIAL, special, sfeatures);
|
||||
zprop_register_mc_props(DEDUP, dedup, sfeatures);
|
||||
zprop_register_mc_props(LOG, log, sfeatures);
|
||||
zprop_register_mc_props(ELOG, elog, sfeatures);
|
||||
zprop_register_mc_props(SELOG, special_elog, sfeatures);
|
||||
|
||||
/* default number properties */
|
||||
zprop_register_number(ZPOOL_PROP_VERSION, "version", SPA_VERSION,
|
||||
|
||||
Reference in New Issue
Block a user