diff options
author | Allan Jude <[email protected]> | 2024-07-25 12:47:36 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2024-07-25 09:47:36 -0700 |
commit | c7ada64bb664d5fab73f255099da5e170e7c82e5 (patch) | |
tree | 9470046a2300896c450b8f08a1b2afe299c88d5d /include/sys | |
parent | 82f281ad99dabc51b6a5ab66a5bd055717d9fcd1 (diff) |
ddt: dedup table quota enforcement
This adds two new pool properties:
- dedup_table_size, the total size of all DDTs on the pool; and
- dedup_table_quota, the maximum possible size of all DDTs in the pool
When set, quota will be enforced by checking when a new entry is about
to be created. If the pool is over its dedup quota, the entry won't be
created, and the corresponding write will be converted to a regular
non-dedup write. Note that existing entries can be updated (ie their
refcounts changed), as that reuses the space rather than requiring more.
dedup_table_quota can be set to 'auto', which will set it based on the
size of the devices backing the "dedup" allocation device. This makes it
possible to limit the DDTs to the size of a dedup vdev only, such that
when the device fills, no new blocks are deduplicated.
Sponsored-by: iXsystems, Inc.
Sponsored-By: Klara Inc.
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Signed-off-by: Don Brady <[email protected]>
Co-authored-by: Don Brady <[email protected]>
Co-authored-by: Rob Wing <[email protected]>
Co-authored-by: Sean Eric Fagan <[email protected]>
Closes #15889
Diffstat (limited to 'include/sys')
-rw-r--r-- | include/sys/ddt.h | 5 | ||||
-rw-r--r-- | include/sys/fs/zfs.h | 2 | ||||
-rw-r--r-- | include/sys/spa.h | 1 | ||||
-rw-r--r-- | include/sys/spa_impl.h | 3 |
4 files changed, 10 insertions, 1 deletions
diff --git a/include/sys/ddt.h b/include/sys/ddt.h index 726f1a390..e0129eda5 100644 --- a/include/sys/ddt.h +++ b/include/sys/ddt.h @@ -151,7 +151,8 @@ enum ddt_phys_type { */ /* State flags for dde_flags */ -#define DDE_FLAG_LOADED (1 << 0) /* entry ready for use */ +#define DDE_FLAG_LOADED (1 << 0) /* entry ready for use */ +#define DDE_FLAG_OVERQUOTA (1 << 1) /* entry unusable, no space */ typedef struct { /* key must be first for ddt_key_compare */ @@ -170,6 +171,7 @@ typedef struct { uint8_t dde_flags; /* load state flags */ kcondvar_t dde_cv; /* signaled when load completes */ + uint64_t dde_waiters; /* count of waiters on dde_cv */ avl_node_t dde_node; /* ddt_tree node */ } ddt_entry_t; @@ -228,6 +230,7 @@ extern void ddt_histogram_add(ddt_histogram_t *dst, const ddt_histogram_t *src); extern void ddt_histogram_stat(ddt_stat_t *dds, const ddt_histogram_t *ddh); extern boolean_t ddt_histogram_empty(const ddt_histogram_t *ddh); extern void ddt_get_dedup_object_stats(spa_t *spa, ddt_object_t *ddo); +extern uint64_t ddt_get_ddt_dsize(spa_t *spa); 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); diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h index b572c22a2..fb461c2f7 100644 --- a/include/sys/fs/zfs.h +++ b/include/sys/fs/zfs.h @@ -258,6 +258,8 @@ typedef enum { ZPOOL_PROP_BCLONEUSED, ZPOOL_PROP_BCLONESAVED, ZPOOL_PROP_BCLONERATIO, + ZPOOL_PROP_DEDUP_TABLE_SIZE, + ZPOOL_PROP_DEDUP_TABLE_QUOTA, ZPOOL_NUM_PROPS } zpool_prop_t; diff --git a/include/sys/spa.h b/include/sys/spa.h index f50cb5e04..df41002ed 100644 --- a/include/sys/spa.h +++ b/include/sys/spa.h @@ -1051,6 +1051,7 @@ extern metaslab_class_t *spa_special_class(spa_t *spa); extern metaslab_class_t *spa_dedup_class(spa_t *spa); extern metaslab_class_t *spa_preferred_class(spa_t *spa, uint64_t size, dmu_object_type_t objtype, uint_t level, uint_t special_smallblk); +extern boolean_t spa_special_has_ddt(spa_t *spa); extern void spa_evicting_os_register(spa_t *, objset_t *os); extern void spa_evicting_os_deregister(spa_t *, objset_t *os); diff --git a/include/sys/spa_impl.h b/include/sys/spa_impl.h index 5605a35b8..47f349327 100644 --- a/include/sys/spa_impl.h +++ b/include/sys/spa_impl.h @@ -465,6 +465,9 @@ struct spa { boolean_t spa_waiters_cancel; /* waiters should return */ char *spa_compatibility; /* compatibility file(s) */ + uint64_t spa_dedup_table_quota; /* property DDT maximum size */ + uint64_t spa_dedup_dsize; /* cached on-disk size of DDT */ + uint64_t spa_dedup_class_full_txg; /* txg dedup class was full */ /* * spa_refcount & spa_config_lock must be the last elements |