MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ddt_sync_table

Function ddt_sync_table

freebsd/contrib/openzfs/module/zfs/ddt.c:1073–1115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1071}
1072
1073static void
1074ddt_sync_table(ddt_t *ddt, dmu_tx_t *tx, uint64_t txg)
1075{
1076 spa_t *spa = ddt->ddt_spa;
1077 ddt_entry_t *dde;
1078 void *cookie = NULL;
1079
1080 if (avl_numnodes(&ddt->ddt_tree) == 0)
1081 return;
1082
1083 ASSERT(spa->spa_uberblock.ub_version >= SPA_VERSION_DEDUP);
1084
1085 if (spa->spa_ddt_stat_object == 0) {
1086 spa->spa_ddt_stat_object = zap_create_link(ddt->ddt_os,
1087 DMU_OT_DDT_STATS, DMU_POOL_DIRECTORY_OBJECT,
1088 DMU_POOL_DDT_STATS, tx);
1089 }
1090
1091 while ((dde = avl_destroy_nodes(&ddt->ddt_tree, &cookie)) != NULL) {
1092 ddt_sync_entry(ddt, dde, tx, txg);
1093 ddt_free(dde);
1094 }
1095
1096 for (enum ddt_type type = 0; type < DDT_TYPES; type++) {
1097 uint64_t add, count = 0;
1098 for (enum ddt_class class = 0; class < DDT_CLASSES; class++) {
1099 if (ddt_object_exists(ddt, type, class)) {
1100 ddt_object_sync(ddt, type, class, tx);
1101 VERIFY(ddt_object_count(ddt, type, class,
1102 &add) == 0);
1103 count += add;
1104 }
1105 }
1106 for (enum ddt_class class = 0; class < DDT_CLASSES; class++) {
1107 if (count == 0 && ddt_object_exists(ddt, type, class))
1108 ddt_object_destroy(ddt, type, class, tx);
1109 }
1110 }
1111
1112 bcopy(ddt->ddt_histogram, &ddt->ddt_histogram_cache,
1113 sizeof (ddt->ddt_histogram));
1114 spa->spa_dedup_dspace = ~0ULL;
1115}
1116
1117void
1118ddt_sync(spa_t *spa, uint64_t txg)

Callers 1

ddt_syncFunction · 0.85

Calls 9

avl_numnodesFunction · 0.85
zap_create_linkFunction · 0.85
avl_destroy_nodesFunction · 0.85
ddt_sync_entryFunction · 0.85
ddt_freeFunction · 0.85
ddt_object_existsFunction · 0.85
ddt_object_syncFunction · 0.85
ddt_object_countFunction · 0.85
ddt_object_destroyFunction · 0.85

Tested by

no test coverage detected