mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 03:08:51 +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:
@@ -248,3 +248,32 @@ ddt_get_pool_dedup_ratio(spa_t *spa)
|
||||
|
||||
return (dds_total.dds_ref_dsize * 100 / dds_total.dds_dsize);
|
||||
}
|
||||
|
||||
int
|
||||
ddt_get_pool_dedup_cached(spa_t *spa, uint64_t *psize)
|
||||
{
|
||||
uint64_t l1sz, l1tot, l2sz, l2tot;
|
||||
int err = 0;
|
||||
|
||||
l1tot = l2tot = 0;
|
||||
*psize = 0;
|
||||
for (enum zio_checksum c = 0; c < ZIO_CHECKSUM_FUNCTIONS; c++) {
|
||||
ddt_t *ddt = spa->spa_ddt[c];
|
||||
if (ddt == NULL)
|
||||
continue;
|
||||
for (ddt_type_t type = 0; type < DDT_TYPES; type++) {
|
||||
for (ddt_class_t class = 0; class < DDT_CLASSES;
|
||||
class++) {
|
||||
err = dmu_object_cached_size(ddt->ddt_os,
|
||||
ddt->ddt_object[type][class], &l1sz, &l2sz);
|
||||
if (err != 0)
|
||||
return (err);
|
||||
l1tot += l1sz;
|
||||
l2tot += l2sz;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*psize = l1tot + l2tot;
|
||||
return (err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user