Lines Matching defs:bucket
80 #define DNS_ADB_INVALIDBUCKET (-1) /*%< invalid bucket address */
124 * XXXRTH Have a per-bucket structure that contains all of these?
138 * XXXRTH Have a per-bucket structure that contains all of these?
562 unsigned int i, n, bucket;
625 bucket = isc_sockaddr_hash(&e->sockaddr, ISC_TRUE) % n;
626 e->lock_bucket = bucket;
627 ISC_LIST_APPEND(newentries[bucket], e, plink);
630 newentry_refcnt[bucket]++;
636 bucket = isc_sockaddr_hash(&e->sockaddr, ISC_TRUE) % n;
637 e->lock_bucket = bucket;
638 ISC_LIST_APPEND(newdeadentries[bucket], e, plink);
641 newentry_refcnt[bucket]++;
719 unsigned int i, n, bucket;
782 bucket = dns_name_fullhash(&name->name, ISC_TRUE) % n;
783 name->lock_bucket = bucket;
784 ISC_LIST_APPEND(newnames[bucket], name, plink);
787 newname_refcnt[bucket]++;
793 bucket = dns_name_fullhash(&name->name, ISC_TRUE) % n;
794 name->lock_bucket = bucket;
795 ISC_LIST_APPEND(newdeadnames[bucket], name, plink);
798 newname_refcnt[bucket]++;
863 * Requires the adbname bucket be locked and that no entry buckets be locked.
1006 * Requires the name's bucket be locked.
1013 int bucket;
1060 bucket = name->lock_bucket;
1061 ISC_LIST_UNLINK(adb->names[bucket], name, plink);
1062 ISC_LIST_APPEND(adb->deadnames[bucket], name, plink);
1070 * Requires the name's bucket be locked and no entry buckets be locked.
1119 * Requires the name's bucket be locked.
1122 link_name(dns_adb_t *adb, int bucket, dns_adbname_t *name) {
1125 ISC_LIST_PREPEND(adb->names[bucket], name, plink);
1126 name->lock_bucket = bucket;
1127 adb->name_refcnt[bucket]++;
1131 * Requires the name's bucket be locked.
1135 int bucket;
1138 bucket = name->lock_bucket;
1139 INSIST(bucket != DNS_ADB_INVALIDBUCKET);
1142 ISC_LIST_UNLINK(adb->deadnames[bucket], name, plink);
1144 ISC_LIST_UNLINK(adb->names[bucket], name, plink);
1146 INSIST(adb->name_refcnt[bucket] > 0);
1147 adb->name_refcnt[bucket]--;
1148 if (adb->name_sd[bucket] && adb->name_refcnt[bucket] == 0)
1154 * Requires the entry's bucket be locked.
1157 link_entry(dns_adb_t *adb, int bucket, dns_adbentry_t *entry) {
1163 e = ISC_LIST_TAIL(adb->entries[bucket]);
1173 ISC_LIST_UNLINK(adb->entries[bucket], e, plink);
1174 ISC_LIST_PREPEND(adb->deadentries[bucket], e, plink);
1178 ISC_LIST_PREPEND(adb->entries[bucket], entry, plink);
1179 entry->lock_bucket = bucket;
1180 adb->entry_refcnt[bucket]++;
1184 * Requires the entry's bucket be locked.
1188 int bucket;
1191 bucket = entry->lock_bucket;
1192 INSIST(bucket != DNS_ADB_INVALIDBUCKET);
1195 ISC_LIST_UNLINK(adb->deadentries[bucket], entry, plink);
1197 ISC_LIST_UNLINK(adb->entries[bucket], entry, plink);
1199 INSIST(adb->entry_refcnt[bucket] > 0);
1200 adb->entry_refcnt[bucket]--;
1201 if (adb->entry_sd[bucket] && adb->entry_refcnt[bucket] == 0)
1221 unsigned int bucket;
1226 for (bucket = 0; bucket < adb->nnames; bucket++) {
1227 LOCK(&adb->namelocks[bucket]);
1228 adb->name_sd[bucket] = ISC_TRUE;
1230 name = ISC_LIST_HEAD(adb->names[bucket]);
1233 * This bucket has no names. We must decrement the
1255 UNLOCK(&adb->namelocks[bucket]);
1266 unsigned int bucket;
1271 for (bucket = 0; bucket < adb->nentries; bucket++) {
1272 LOCK(&adb->entrylocks[bucket]);
1273 adb->entry_sd[bucket] = ISC_TRUE;
1275 entry = ISC_LIST_HEAD(adb->entries[bucket]);
1276 if (adb->entry_refcnt[bucket] == 0) {
1278 * This bucket has no entries. We must decrement the
1301 UNLOCK(&adb->entrylocks[bucket]);
1307 * Name bucket must be locked
1319 * Assumes the name bucket is locked.
1463 * Assumes the name bucket is locked.
1613 int bucket;
1615 bucket = entry->lock_bucket;
1618 LOCK(&adb->entrylocks[bucket]);
1623 UNLOCK(&adb->entrylocks[bucket]);
1630 int bucket;
1634 bucket = entry->lock_bucket;
1637 LOCK(&adb->entrylocks[bucket]);
1644 (adb->entry_sd[bucket] || entry->expires == 0 || overmem ||
1651 UNLOCK(&adb->entrylocks[bucket]);
2030 * Search for the name. NOTE: The bucket is kept locked on both
2041 int bucket;
2043 bucket = dns_name_fullhash(name, ISC_FALSE) % adb->nnames;
2046 LOCK(&adb->namelocks[bucket]);
2047 *bucketp = bucket;
2048 } else if (*bucketp != bucket) {
2050 LOCK(&adb->namelocks[bucket]);
2051 *bucketp = bucket;
2054 adbname = ISC_LIST_HEAD(adb->names[bucket]);
2069 * Search for the address. NOTE: The bucket is kept locked on both
2076 * the bucket changes.
2083 int bucket;
2085 bucket = isc_sockaddr_hash(addr, ISC_TRUE) % adb->nentries;
2088 LOCK(&adb->entrylocks[bucket]);
2089 *bucketp = bucket;
2090 } else if (*bucketp != bucket) {
2092 LOCK(&adb->entrylocks[bucket]);
2093 *bucketp = bucket;
2097 for (entry = ISC_LIST_HEAD(adb->entries[bucket]);
2105 ISC_LIST_UNLINK(adb->entries[bucket], entry, plink);
2106 ISC_LIST_PREPEND(adb->entries[bucket], entry, plink);
2115 * Entry bucket MUST be locked!
2183 int bucket;
2185 bucket = DNS_ADB_INVALIDBUCKET;
2191 bucket = entry->lock_bucket;
2192 INSIST(bucket != DNS_ADB_INVALIDBUCKET);
2193 LOCK(&adb->entrylocks[bucket]);
2221 UNLOCK(&adb->entrylocks[bucket]);
2222 bucket = DNS_ADB_INVALIDBUCKET;
2231 bucket = entry->lock_bucket;
2232 INSIST(bucket != DNS_ADB_INVALIDBUCKET);
2233 LOCK(&adb->entrylocks[bucket]);
2261 UNLOCK(&adb->entrylocks[bucket]);
2262 bucket = DNS_ADB_INVALIDBUCKET;
2268 if (bucket != DNS_ADB_INVALIDBUCKET)
2269 UNLOCK(&adb->entrylocks[bucket]);
2291 * Name bucket must be locked; adb may be locked; no other locks held.
2334 * Name bucket must be locked; adb may be locked; no other locks held.
2337 check_stale_name(dns_adb_t *adb, int bucket, isc_stdtime_t now) {
2343 INSIST(bucket != DNS_ADB_INVALIDBUCKET);
2353 victim = ISC_LIST_TAIL(adb->names[bucket]);
2381 * Entry bucket must be locked; adb may be locked; no other locks held.
2415 cleanup_names(dns_adb_t *adb, int bucket, isc_stdtime_t now) {
2420 DP(CLEAN_LEVEL, "cleaning name bucket %d", bucket);
2422 LOCK(&adb->namelocks[bucket]);
2423 if (adb->name_sd[bucket]) {
2424 UNLOCK(&adb->namelocks[bucket]);
2428 name = ISC_LIST_HEAD(adb->names[bucket]);
2437 UNLOCK(&adb->namelocks[bucket]);
2445 cleanup_entries(dns_adb_t *adb, int bucket, isc_stdtime_t now) {
2449 DP(CLEAN_LEVEL, "cleaning entry bucket %d", bucket);
2451 LOCK(&adb->entrylocks[bucket]);
2452 entry = ISC_LIST_HEAD(adb->entries[bucket]);
2459 UNLOCK(&adb->entrylocks[bucket]);
2662 * Initialize the bucket locks for names and elements.
2950 int bucket;
3025 bucket = DNS_ADB_INVALIDBUCKET;
3026 adbname = find_name_and_lock(adb, name, find->options, &bucket);
3027 INSIST(bucket != DNS_ADB_INVALIDBUCKET);
3028 if (adb->name_sd[bucket]) {
3044 check_stale_name(adb, bucket, now);
3052 link_name(adb, bucket, adbname);
3061 ISC_LIST_UNLINK(adb->names[bucket], adbname, plink);
3062 ISC_LIST_PREPEND(adb->names[bucket], adbname, plink);
3230 find->name_bucket = bucket;
3283 UNLOCK(&adb->namelocks[bucket]);
3293 int bucket;
3310 bucket = find->name_bucket;
3311 INSIST(bucket == DNS_ADB_INVALIDBUCKET);
3351 int bucket;
3364 bucket = find->name_bucket;
3365 if (bucket == DNS_ADB_INVALIDBUCKET)
3371 unlock_bucket = bucket;
3373 bucket = find->name_bucket;
3374 if (bucket != DNS_ADB_INVALIDBUCKET) {
3380 bucket = DNS_ADB_INVALIDBUCKET;
3381 POST(bucket);
3466 fprintf(f, "; bucket %d\n", i);
3827 int bucket;
3843 bucket = name->lock_bucket;
3844 LOCK(&adb->namelocks[bucket]);
3885 UNLOCK(&adb->namelocks[bucket]);
3999 UNLOCK(&adb->namelocks[bucket]);
4087 int bucket;
4094 bucket = addr->entry->lock_bucket;
4095 LOCK(&adb->entrylocks[bucket]);
4115 UNLOCK(&adb->entrylocks[bucket]);
4124 int bucket;
4131 bucket = addr->entry->lock_bucket;
4132 LOCK(&adb->entrylocks[bucket]);
4138 UNLOCK(&adb->entrylocks[bucket]);
4143 int bucket;
4148 bucket = addr->entry->lock_bucket;
4149 LOCK(&adb->entrylocks[bucket]);
4153 UNLOCK(&adb->entrylocks[bucket]);
4186 int bucket;
4195 bucket = addr->entry->lock_bucket;
4196 LOCK(&adb->entrylocks[bucket]);
4210 UNLOCK(&adb->entrylocks[bucket]);
4288 int bucket;
4294 bucket = addr->entry->lock_bucket;
4295 LOCK(&adb->entrylocks[bucket]);
4317 UNLOCK(&adb->entrylocks[bucket]);
4323 int bucket;
4328 bucket = addr->entry->lock_bucket;
4329 LOCK(&adb->entrylocks[bucket]);
4343 UNLOCK(&adb->entrylocks[bucket]);
4348 int bucket;
4353 bucket = addr->entry->lock_bucket;
4354 LOCK(&adb->entrylocks[bucket]);
4380 UNLOCK(&adb->entrylocks[bucket]);
4385 int bucket;
4390 bucket = addr->entry->lock_bucket;
4391 LOCK(&adb->entrylocks[bucket]);
4427 UNLOCK(&adb->entrylocks[bucket]);
4432 int bucket;
4437 bucket = addr->entry->lock_bucket;
4438 LOCK(&adb->entrylocks[bucket]);
4456 UNLOCK(&adb->entrylocks[bucket]);
4461 int bucket;
4467 bucket = addr->entry->lock_bucket;
4468 LOCK(&adb->entrylocks[bucket]);
4470 UNLOCK(&adb->entrylocks[bucket]);
4482 int bucket;
4488 bucket = addr->entry->lock_bucket;
4489 LOCK(&adb->entrylocks[bucket]);
4505 UNLOCK(&adb->entrylocks[bucket]);
4514 int bucket;
4519 bucket = addr->entry->lock_bucket;
4520 LOCK(&adb->entrylocks[bucket]);
4538 UNLOCK(&adb->entrylocks[bucket]);
4545 int bucket;
4550 bucket = addr->entry->lock_bucket;
4551 LOCK(&adb->entrylocks[bucket]);
4559 UNLOCK(&adb->entrylocks[bucket]);
4568 int bucket;
4580 bucket = DNS_ADB_INVALIDBUCKET;
4581 entry = find_entry_and_lock(adb, sa, &bucket, now);
4582 INSIST(bucket != DNS_ADB_INVALIDBUCKET);
4583 if (adb->entry_sd[bucket]) {
4597 link_entry(adb, bucket, entry);
4612 UNLOCK(&adb->entrylocks[bucket]);
4621 int bucket;
4636 bucket = addr->entry->lock_bucket;
4637 LOCK(&adb->entrylocks[bucket]);
4646 UNLOCK(&adb->entrylocks[bucket]);
4685 int bucket;
4691 bucket = dns_name_hash(name, ISC_FALSE) % adb->nnames;
4692 LOCK(&adb->namelocks[bucket]);
4693 adbname = ISC_LIST_HEAD(adb->names[bucket]);
4704 UNLOCK(&adb->namelocks[bucket]);
4797 int bucket;
4802 bucket = addr->entry->lock_bucket;
4804 LOCK(&adb->entrylocks[bucket]);
4806 UNLOCK(&adb->entrylocks[bucket]);
4811 int bucket;
4816 bucket = addr->entry->lock_bucket;
4818 LOCK(&adb->entrylocks[bucket]);
4821 UNLOCK(&adb->entrylocks[bucket]);