From 327768e280958a0019a8eff19a98cb5fbc341685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 27 Jul 2022 13:45:15 +0200 Subject: [PATCH] dns_adb: Remove deadnames and deadentries Previously, the name and entry buckets were much larger, so the dead names and entries were moved to a secondary list to be cleaned later (f.e. after the already running fetch has been canceled). After the last refactoring, the bucket now contains only the name (entry) itself and thus the extra list has a little use. Remove the .deadnames and .deadentries from dns_adbnamebucket_t and dns_adbentrybucket_t structures. --- lib/dns/adb.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/lib/dns/adb.c b/lib/dns/adb.c index c8c566bdeb..ad72c6ab4a 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -171,7 +171,6 @@ struct dns_adbname { */ struct dns_adbnamebucket { dns_adbnamelist_t names; - dns_adbnamelist_t deadnames; isc_mutex_t lock; isc_refcount_t references; size_t keysize; @@ -278,7 +277,6 @@ struct dns_adbentry { */ struct dns_adbentrybucket { dns_adbentrylist_t entries; - dns_adbentrylist_t deadentries; isc_mutex_t lock; isc_refcount_t references; size_t keysize; @@ -790,9 +788,6 @@ expire_name(dns_adbname_t **n, isc_eventtype_t evtype) { * we'll clean it up later. */ if (!NAME_DEAD(adbname)) { - dns_adbnamebucket_t *nbucket = adbname->bucket; - ISC_LIST_UNLINK(nbucket->names, adbname, plink); - ISC_LIST_APPEND(nbucket->deadnames, adbname, plink); adbname->flags |= NAME_IS_DEAD; } } @@ -874,11 +869,7 @@ unlink_name(dns_adbname_t *name) { REQUIRE(nbucket != NULL); - if (NAME_DEAD(name)) { - ISC_LIST_UNLINK(nbucket->deadnames, name, plink); - } else { - ISC_LIST_UNLINK(nbucket->names, name, plink); - } + ISC_LIST_UNLINK(nbucket->names, name, plink); isc_refcount_decrement(&nbucket->references); } @@ -922,8 +913,6 @@ link_entry(dns_adbentrybucket_t *ebucket, dns_adbentry_t *entry) { INSIST((e->flags & ENTRY_IS_DEAD) == 0); e->flags |= ENTRY_IS_DEAD; - ISC_LIST_UNLINK(ebucket->entries, e, plink); - ISC_LIST_PREPEND(ebucket->deadentries, e, plink); } } @@ -949,11 +938,7 @@ unlink_entry(dns_adbentry_t *entry) { DP(DEF_LEVEL, "unlink ADB entry %p from bucket %p", entry, ebucket); - if ((entry->flags & ENTRY_IS_DEAD) != 0) { - ISC_LIST_UNLINK(ebucket->deadentries, entry, plink); - } else { - ISC_LIST_UNLINK(ebucket->entries, entry, plink); - } + ISC_LIST_UNLINK(ebucket->entries, entry, plink); isc_refcount_decrement(&ebucket->references); } @@ -1479,7 +1464,6 @@ new_adbentrybucket(dns_adb_t *adb, const uint8_t *key, const size_t keysize) { memmove(ebucket->key, key, keysize); ISC_LIST_INIT(ebucket->entries); - ISC_LIST_INIT(ebucket->deadentries); isc_mutex_init(&ebucket->lock); isc_refcount_init(&ebucket->references, 0);