mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-26 12:12:13 +03:00
ddt: add support for prefetching tables into the ARC
This change adds a new `zpool prefetch -t ddt $pool` command which causes a pool's DDT to be loaded into the ARC. The primary goal is to remove the need to "warm" a pool's cache before deduplication stops slowing write performance. It may also provide a way to reload portions of a DDT if they have been flushed due to inactivity. Sponsored-by: iXsystems, Inc. Sponsored-by: Catalogics, Inc. Sponsored-by: Klara, Inc. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Allan Jude <allan@klarasystems.com> Signed-off-by: Will Andrews <will.andrews@klarasystems.com> Signed-off-by: Fred Weigel <fred.weigel@klarasystems.com> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Signed-off-by: Don Brady <don.brady@klarasystems.com> Co-authored-by: Will Andrews <will.andrews@klarasystems.com> Co-authored-by: Don Brady <don.brady@klarasystems.com> Closes #15890
This commit is contained in:
+55
-4
@@ -34,7 +34,7 @@
|
||||
* Copyright (c) 2017, Intel Corporation.
|
||||
* Copyright (c) 2021, Colm Buckley <colm@tuatha.org>
|
||||
* Copyright (c) 2023 Hewlett Packard Enterprise Development LP.
|
||||
* Copyright (c) 2024, Klara Inc.
|
||||
* Copyright (c) 2023, 2024, Klara Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -337,6 +337,55 @@ spa_prop_add_list(nvlist_t *nvl, zpool_prop_t prop, const char *strval,
|
||||
nvlist_free(propval);
|
||||
}
|
||||
|
||||
static int
|
||||
spa_prop_add(spa_t *spa, const char *propname, nvlist_t *outnvl)
|
||||
{
|
||||
zpool_prop_t prop = zpool_name_to_prop(propname);
|
||||
zprop_source_t src = ZPROP_SRC_NONE;
|
||||
uint64_t intval;
|
||||
int err;
|
||||
|
||||
/*
|
||||
* NB: Not all properties lookups via this API require
|
||||
* the spa props lock, so they must explicitly grab it here.
|
||||
*/
|
||||
switch (prop) {
|
||||
case ZPOOL_PROP_DEDUPCACHED:
|
||||
err = ddt_get_pool_dedup_cached(spa, &intval);
|
||||
if (err != 0)
|
||||
return (SET_ERROR(err));
|
||||
break;
|
||||
default:
|
||||
return (SET_ERROR(EINVAL));
|
||||
}
|
||||
|
||||
spa_prop_add_list(outnvl, prop, NULL, intval, src);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
spa_prop_get_nvlist(spa_t *spa, char **props, unsigned int n_props,
|
||||
nvlist_t **outnvl)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
if (props == NULL)
|
||||
return (0);
|
||||
|
||||
if (*outnvl == NULL) {
|
||||
err = nvlist_alloc(outnvl, NV_UNIQUE_NAME, KM_SLEEP);
|
||||
if (err)
|
||||
return (err);
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < n_props && err == 0; i++) {
|
||||
err = spa_prop_add(spa, props[i], *outnvl);
|
||||
}
|
||||
|
||||
return (err);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a user property (source=src, propname=propval) to an nvlist.
|
||||
*/
|
||||
@@ -503,9 +552,11 @@ spa_prop_get(spa_t *spa, nvlist_t **nvp)
|
||||
dsl_pool_t *dp;
|
||||
int err;
|
||||
|
||||
err = nvlist_alloc(nvp, NV_UNIQUE_NAME, KM_SLEEP);
|
||||
if (err)
|
||||
return (err);
|
||||
if (*nvp == NULL) {
|
||||
err = nvlist_alloc(nvp, NV_UNIQUE_NAME, KM_SLEEP);
|
||||
if (err)
|
||||
return (err);
|
||||
}
|
||||
|
||||
dp = spa_get_dsl(spa);
|
||||
dsl_pool_config_enter(dp, FTAG);
|
||||
|
||||
Reference in New Issue
Block a user