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.
This commit is contained in:
Ondřej Surý 2022-07-27 13:45:15 +02:00
parent f4229a92c9
commit 327768e280
No known key found for this signature in database
GPG key ID: 2820F37E873DEA41

View file

@ -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);