2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

Remove origin_node from qpcache

The origin_node in qpcache was always NULL, so we can remove the
getoriginode() function and origin_node pointer as the
dns_db_getoriginnode() correctly returns ISC_R_NOTFOUND when the
function is not implemented.
This commit is contained in:
Ondřej Surý 2025-01-27 18:13:38 +01:00
parent 814b87da64
commit 36a26bfa1a
No known key found for this signature in database
GPG Key ID: 2820F37E873DEA41

View File

@ -207,7 +207,6 @@ struct qpcache {
/* Locks for individual tree nodes */ /* Locks for individual tree nodes */
unsigned int node_lock_count; unsigned int node_lock_count;
db_nodelock_t *node_locks; db_nodelock_t *node_locks;
qpcnode_t *origin_node;
dns_stats_t *rrsetstats; /* cache DB only */ dns_stats_t *rrsetstats; /* cache DB only */
isc_stats_t *cachestats; /* cache DB only */ isc_stats_t *cachestats; /* cache DB only */
isc_stats_t *gluecachestats; /* zone DB only */ isc_stats_t *gluecachestats; /* zone DB only */
@ -720,7 +719,7 @@ decref(qpcache_t *qpdb, qpcnode_t *node, isc_rwlocktype_t *nlocktypep,
} }
/* Handle easy and typical case first. */ /* Handle easy and typical case first. */
if (!node->dirty && (node->data != NULL || node == qpdb->origin_node)) { if (!node->dirty && node->data != NULL) {
goto unref; goto unref;
} }
@ -778,7 +777,7 @@ decref(qpcache_t *qpdb, qpcnode_t *node, isc_rwlocktype_t *nlocktypep,
write_locked = true; write_locked = true;
} }
if (node->data != NULL || node == qpdb->origin_node) { if (node->data != NULL) {
goto restore_locks; goto restore_locks;
} }
@ -2555,10 +2554,6 @@ qpcache_destroy(dns_db_t *arg) {
unsigned int i; unsigned int i;
unsigned int inactive = 0; unsigned int inactive = 0;
if (qpdb->origin_node != NULL) {
qpcnode_detach(&qpdb->origin_node);
}
/* /*
* Even though there are no external direct references, there still * Even though there are no external direct references, there still
* may be nodes in use. * may be nodes in use.
@ -3622,28 +3617,6 @@ nodecount(dns_db_t *db, dns_dbtree_t tree) {
return mu.leaves; return mu.leaves;
} }
static isc_result_t
getoriginnode(dns_db_t *db, dns_dbnode_t **nodep DNS__DB_FLARG) {
qpcache_t *qpdb = (qpcache_t *)db;
qpcnode_t *onode = NULL;
isc_result_t result = ISC_R_SUCCESS;
REQUIRE(VALID_QPDB(qpdb));
REQUIRE(nodep != NULL && *nodep == NULL);
/* Note that the access to origin_node doesn't require a DB lock */
onode = (qpcnode_t *)qpdb->origin_node;
if (onode != NULL) {
newref(qpdb, onode, isc_rwlocktype_none,
isc_rwlocktype_none DNS__DB_FLARG_PASS);
*nodep = (dns_dbnode_t *)qpdb->origin_node;
} else {
result = ISC_R_NOTFOUND;
}
return result;
}
static void static void
locknode(dns_db_t *db, dns_dbnode_t *node, isc_rwlocktype_t type) { locknode(dns_db_t *db, dns_dbnode_t *node, isc_rwlocktype_t type) {
qpcache_t *qpdb = (qpcache_t *)db; qpcache_t *qpdb = (qpcache_t *)db;
@ -4387,7 +4360,6 @@ static dns_dbmethods_t qpdb_cachemethods = {
.addrdataset = qpcache_addrdataset, .addrdataset = qpcache_addrdataset,
.deleterdataset = qpcache_deleterdataset, .deleterdataset = qpcache_deleterdataset,
.nodecount = nodecount, .nodecount = nodecount,
.getoriginnode = getoriginnode,
.getrrsetstats = getrrsetstats, .getrrsetstats = getrrsetstats,
.setcachestats = setcachestats, .setcachestats = setcachestats,
.setservestalettl = setservestalettl, .setservestalettl = setservestalettl,