Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/sys/ddt.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ extern void ddt_get_dedup_histogram(spa_t *spa, ddt_histogram_t *ddh);
extern void ddt_get_dedup_stats(spa_t *spa, ddt_stat_t *dds_total);

extern uint64_t ddt_get_dedup_dspace(spa_t *spa);
extern uint64_t ddt_get_dedup_used(spa_t *spa);
extern uint64_t ddt_get_dedup_saved(spa_t *spa);
extern uint64_t ddt_get_pool_dedup_ratio(spa_t *spa);
extern int ddt_get_pool_dedup_cached(spa_t *spa, uint64_t *psize);

Expand Down
2 changes: 2 additions & 0 deletions include/sys/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ typedef enum {
ZPOOL_PROP_DEDUP_TABLE_QUOTA,
ZPOOL_PROP_DEDUPCACHED,
ZPOOL_PROP_LAST_SCRUBBED_TXG,
ZPOOL_PROP_DEDUPUSED,
ZPOOL_PROP_DEDUPSAVED,
ZPOOL_NUM_PROPS
} zpool_prop_t;

Expand Down
4 changes: 3 additions & 1 deletion lib/libzfs/libzfs.abi
Original file line number Diff line number Diff line change
Expand Up @@ -3370,7 +3370,9 @@
<enumerator name='ZPOOL_PROP_DEDUP_TABLE_QUOTA' value='37'/>
<enumerator name='ZPOOL_PROP_DEDUPCACHED' value='38'/>
<enumerator name='ZPOOL_PROP_LAST_SCRUBBED_TXG' value='39'/>
<enumerator name='ZPOOL_NUM_PROPS' value='40'/>
<enumerator name='ZPOOL_PROP_DEDUPUSED' value='40'/>
<enumerator name='ZPOOL_PROP_DEDUPSAVED' value='41'/>
<enumerator name='ZPOOL_NUM_PROPS' value='42'/>
</enum-decl>
<typedef-decl name='zpool_prop_t' type-id='af1ba157' id='5d0c23fb'/>
<typedef-decl name='regoff_t' type-id='95e97e5e' id='54a2a2a8'/>
Expand Down
2 changes: 2 additions & 0 deletions lib/libzfs/libzfs_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,8 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf,
case ZPOOL_PROP_BCLONESAVED:
case ZPOOL_PROP_BCLONEUSED:
case ZPOOL_PROP_DEDUP_TABLE_SIZE:
case ZPOOL_PROP_DEDUPUSED:
case ZPOOL_PROP_DEDUPSAVED:
case ZPOOL_PROP_DEDUPCACHED:
if (literal)
(void) snprintf(buf, len, "%llu",
Expand Down
15 changes: 15 additions & 0 deletions man/man7/zpoolprops.7
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,21 @@ See
.Xr zpool-prefetch 8 .
.It Sy dedup_table_size
Total on-disk size of the deduplication table.
.It Sy dedupratio
The ratio of the total amount of storage that would be required to store all
the deduplicated blocks without deduplication to the actual storage used.
The
.Sy dedupratio
property is calculated as:
.Pp
.Sy ( ( dedupsaved + dedupused ) * 100 ) / dedupused
.It Sy dedupsaved
The amount of additional storage that would be required if deduplication
was not used.
This represents the space saved by deduplication.
.It Sy dedupused
The amount of storage used by deduplicated blocks.
This is the actual physical space occupied on disk after deduplication.
.It Sy expandsize
Amount of uninitialized space within the pool or device that can be used to
increase the total capacity of the pool.
Expand Down
6 changes: 6 additions & 0 deletions module/zcommon/zpool_prop.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ zpool_prop_init(void)
zprop_register_number(ZPOOL_PROP_DEDUPRATIO, "dedupratio", 0,
PROP_READONLY, ZFS_TYPE_POOL, "<1.00x or higher if deduped>",
"DEDUP", B_FALSE, sfeatures);
zprop_register_number(ZPOOL_PROP_DEDUPUSED, "dedupused", 0,
PROP_READONLY, ZFS_TYPE_POOL, "<size>",
"DEDUP_USED", B_FALSE, sfeatures);
zprop_register_number(ZPOOL_PROP_DEDUPSAVED, "dedupsaved", 0,
PROP_READONLY, ZFS_TYPE_POOL, "<size>",
"DEDUP_SAVED", B_FALSE, sfeatures);
zprop_register_number(ZPOOL_PROP_BCLONEUSED, "bcloneused", 0,
PROP_READONLY, ZFS_TYPE_POOL, "<size>",
"BCLONE_USED", B_FALSE, sfeatures);
Expand Down
15 changes: 15 additions & 0 deletions module/zfs/ddt_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,21 @@ ddt_get_dedup_dspace(spa_t *spa)
return (spa->spa_dedup_dspace);
}

uint64_t
ddt_get_dedup_used(spa_t *spa)
{
ddt_stat_t dds_total = { 0 };

ddt_get_dedup_stats(spa, &dds_total);
return (dds_total.dds_dsize);
}

uint64_t
ddt_get_dedup_saved(spa_t *spa)
{
return (ddt_get_dedup_dspace(spa));
}

uint64_t
ddt_get_pool_dedup_ratio(spa_t *spa)
{
Expand Down
4 changes: 4 additions & 0 deletions module/zfs/spa.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,10 @@ spa_prop_get_config(spa_t *spa, nvlist_t *nv)

spa_prop_add_list(nv, ZPOOL_PROP_DEDUPRATIO, NULL,
ddt_get_pool_dedup_ratio(spa), src);
spa_prop_add_list(nv, ZPOOL_PROP_DEDUPUSED, NULL,
ddt_get_dedup_used(spa), src);
spa_prop_add_list(nv, ZPOOL_PROP_DEDUPSAVED, NULL,
ddt_get_dedup_saved(spa), src);
spa_prop_add_list(nv, ZPOOL_PROP_BCLONEUSED, NULL,
brt_get_used(spa), src);
spa_prop_add_list(nv, ZPOOL_PROP_BCLONESAVED, NULL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ typeset -a properties=(
"bclonesaved"
"bcloneratio"
"last_scrubbed_txg"
"dedupused"
"dedupsaved"
"feature@async_destroy"
"feature@empty_bpobj"
"feature@lz4_compress"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@
#

# Set the expected properties of zpool
typeset -a properties=("allocated" "capacity" "expandsize" "free" "freeing"
"leaked" "size")
typeset -a properties=("allocated" "bcloneused" "bclonesaved" "capacity"
"dedupused" "dedupsaved" "expandsize" "free" "freeing" "leaked" "size")
Loading