Lines Matching refs:bucket

97 #define DNS_ADB_INVALIDBUCKET (-1)      /*%< invalid bucket address */
140 * XXXRTH Have a per-bucket structure that contains all of these?
154 * XXXRTH Have a per-bucket structure that contains all of these?
487 * Requires the adbname bucket be locked and that no entry buckets be locked.
626 * Requires the name's bucket be locked.
633 int bucket;
680 bucket = name->lock_bucket;
681 ISC_LIST_UNLINK(adb->names[bucket], name, plink);
682 ISC_LIST_APPEND(adb->deadnames[bucket], name, plink);
690 * Requires the name's bucket be locked and no entry buckets be locked.
739 * Requires the name's bucket be locked.
742 link_name(dns_adb_t *adb, int bucket, dns_adbname_t *name) {
745 ISC_LIST_PREPEND(adb->names[bucket], name, plink);
746 name->lock_bucket = bucket;
747 adb->name_refcnt[bucket]++;
751 * Requires the name's bucket be locked.
755 int bucket;
758 bucket = name->lock_bucket;
759 INSIST(bucket != DNS_ADB_INVALIDBUCKET);
762 ISC_LIST_UNLINK(adb->deadnames[bucket], name, plink);
764 ISC_LIST_UNLINK(adb->names[bucket], name, plink);
766 INSIST(adb->name_refcnt[bucket] > 0);
767 adb->name_refcnt[bucket]--;
768 if (adb->name_sd[bucket] && adb->name_refcnt[bucket] == 0)
774 * Requires the entry's bucket be locked.
777 link_entry(dns_adb_t *adb, int bucket, dns_adbentry_t *entry) {
783 e = ISC_LIST_TAIL(adb->entries[bucket]);
793 ISC_LIST_UNLINK(adb->entries[bucket], e, plink);
794 ISC_LIST_PREPEND(adb->deadentries[bucket], e, plink);
798 ISC_LIST_PREPEND(adb->entries[bucket], entry, plink);
799 entry->lock_bucket = bucket;
800 adb->entry_refcnt[bucket]++;
804 * Requires the entry's bucket be locked.
808 int bucket;
811 bucket = entry->lock_bucket;
812 INSIST(bucket != DNS_ADB_INVALIDBUCKET);
815 ISC_LIST_UNLINK(adb->deadentries[bucket], entry, plink);
817 ISC_LIST_UNLINK(adb->entries[bucket], entry, plink);
819 INSIST(adb->entry_refcnt[bucket] > 0);
820 adb->entry_refcnt[bucket]--;
821 if (adb->entry_sd[bucket] && adb->entry_refcnt[bucket] == 0)
841 int bucket;
846 for (bucket = 0; bucket < NBUCKETS; bucket++) {
847 LOCK(&adb->namelocks[bucket]);
848 adb->name_sd[bucket] = ISC_TRUE;
850 name = ISC_LIST_HEAD(adb->names[bucket]);
853 * This bucket has no names. We must decrement the
875 UNLOCK(&adb->namelocks[bucket]);
886 int bucket;
891 for (bucket = 0; bucket < NBUCKETS; bucket++) {
892 LOCK(&adb->entrylocks[bucket]);
893 adb->entry_sd[bucket] = ISC_TRUE;
895 entry = ISC_LIST_HEAD(adb->entries[bucket]);
896 if (adb->entry_refcnt[bucket] == 0) {
898 * This bucket has no entries. We must decrement the
921 UNLOCK(&adb->entrylocks[bucket]);
927 * Name bucket must be locked
939 * Assumes the name bucket is locked.
1082 * Assumes the name bucket is locked.
1228 int bucket;
1230 bucket = entry->lock_bucket;
1233 LOCK(&adb->entrylocks[bucket]);
1238 UNLOCK(&adb->entrylocks[bucket]);
1245 int bucket;
1249 bucket = entry->lock_bucket;
1252 LOCK(&adb->entrylocks[bucket]);
1259 (adb->entry_sd[bucket] || entry->expires == 0 || overmem ||
1266 UNLOCK(&adb->entrylocks[bucket]);
1590 * Search for the name. NOTE: The bucket is kept locked on both
1601 int bucket;
1603 bucket = dns_name_fullhash(name, ISC_FALSE) % NBUCKETS;
1606 LOCK(&adb->namelocks[bucket]);
1607 *bucketp = bucket;
1608 } else if (*bucketp != bucket) {
1610 LOCK(&adb->namelocks[bucket]);
1611 *bucketp = bucket;
1614 adbname = ISC_LIST_HEAD(adb->names[bucket]);
1629 * Search for the address. NOTE: The bucket is kept locked on both
1636 * the bucket changes.
1643 int bucket;
1645 bucket = isc_sockaddr_hash(addr, ISC_TRUE) % NBUCKETS;
1648 LOCK(&adb->entrylocks[bucket]);
1649 *bucketp = bucket;
1650 } else if (*bucketp != bucket) {
1652 LOCK(&adb->entrylocks[bucket]);
1653 *bucketp = bucket;
1657 for (entry = ISC_LIST_HEAD(adb->entries[bucket]);
1664 ISC_LIST_UNLINK(adb->entries[bucket], entry, plink);
1665 ISC_LIST_PREPEND(adb->entries[bucket], entry, plink);
1674 * Entry bucket MUST be locked!
1723 int bucket;
1725 bucket = DNS_ADB_INVALIDBUCKET;
1731 bucket = entry->lock_bucket;
1732 INSIST(bucket != DNS_ADB_INVALIDBUCKET);
1733 LOCK(&adb->entrylocks[bucket]);
1752 UNLOCK(&adb->entrylocks[bucket]);
1753 bucket = DNS_ADB_INVALIDBUCKET;
1762 bucket = entry->lock_bucket;
1763 INSIST(bucket != DNS_ADB_INVALIDBUCKET);
1764 LOCK(&adb->entrylocks[bucket]);
1783 UNLOCK(&adb->entrylocks[bucket]);
1784 bucket = DNS_ADB_INVALIDBUCKET;
1790 if (bucket != DNS_ADB_INVALIDBUCKET)
1791 UNLOCK(&adb->entrylocks[bucket]);
1813 * Name bucket must be locked; adb may be locked; no other locks held.
1856 * Name bucket must be locked; adb may be locked; no other locks held.
1859 check_stale_name(dns_adb_t *adb, int bucket, isc_stdtime_t now) {
1865 INSIST(bucket != DNS_ADB_INVALIDBUCKET);
1875 victim = ISC_LIST_TAIL(adb->names[bucket]);
1903 * Entry bucket must be locked; adb may be locked; no other locks held.
1937 cleanup_names(dns_adb_t *adb, int bucket, isc_stdtime_t now) {
1942 DP(CLEAN_LEVEL, "cleaning name bucket %d", bucket);
1944 LOCK(&adb->namelocks[bucket]);
1945 if (adb->name_sd[bucket]) {
1946 UNLOCK(&adb->namelocks[bucket]);
1950 name = ISC_LIST_HEAD(adb->names[bucket]);
1959 UNLOCK(&adb->namelocks[bucket]);
1967 cleanup_entries(dns_adb_t *adb, int bucket, isc_stdtime_t now) {
1971 DP(CLEAN_LEVEL, "cleaning entry bucket %d", bucket);
1973 LOCK(&adb->entrylocks[bucket]);
1974 entry = ISC_LIST_HEAD(adb->entries[bucket]);
1981 UNLOCK(&adb->entrylocks[bucket]);
2080 * Initialize the bucket locks for names and elements.
2287 int bucket;
2356 bucket = DNS_ADB_INVALIDBUCKET;
2357 adbname = find_name_and_lock(adb, name, find->options, &bucket);
2358 INSIST(bucket != DNS_ADB_INVALIDBUCKET);
2359 if (adb->name_sd[bucket]) {
2375 check_stale_name(adb, bucket, now);
2383 link_name(adb, bucket, adbname);
2392 ISC_LIST_UNLINK(adb->names[bucket], adbname, plink);
2393 ISC_LIST_PREPEND(adb->names[bucket], adbname, plink);
2562 find->name_bucket = bucket;
2615 UNLOCK(&adb->namelocks[bucket]);
2625 int bucket;
2642 bucket = find->name_bucket;
2643 INSIST(bucket == DNS_ADB_INVALIDBUCKET);
2683 int bucket;
2696 bucket = find->name_bucket;
2697 if (bucket == DNS_ADB_INVALIDBUCKET)
2703 unlock_bucket = bucket;
2705 bucket = find->name_bucket;
2706 if (bucket != DNS_ADB_INVALIDBUCKET) {
2712 bucket = DNS_ADB_INVALIDBUCKET;
2713 POST(bucket);
2795 fprintf(f, "; bucket %d\n", i);
3126 int bucket;
3142 bucket = name->lock_bucket;
3143 LOCK(&adb->namelocks[bucket]);
3184 UNLOCK(&adb->namelocks[bucket]);
3292 UNLOCK(&adb->namelocks[bucket]);
3379 int bucket;
3386 bucket = addr->entry->lock_bucket;
3387 LOCK(&adb->entrylocks[bucket]);
3407 UNLOCK(&adb->entrylocks[bucket]);
3416 int bucket;
3424 bucket = addr->entry->lock_bucket;
3425 LOCK(&adb->entrylocks[bucket]);
3441 UNLOCK(&adb->entrylocks[bucket]);
3448 int bucket;
3454 bucket = addr->entry->lock_bucket;
3455 LOCK(&adb->entrylocks[bucket]);
3469 UNLOCK(&adb->entrylocks[bucket]);
3476 int bucket;
3488 bucket = DNS_ADB_INVALIDBUCKET;
3489 entry = find_entry_and_lock(adb, sa, &bucket, now);
3490 INSIST(bucket != DNS_ADB_INVALIDBUCKET);
3491 if (adb->entry_sd[bucket]) {
3505 link_entry(adb, bucket, entry);
3520 UNLOCK(&adb->entrylocks[bucket]);
3529 int bucket;
3544 bucket = addr->entry->lock_bucket;
3545 LOCK(&adb->entrylocks[bucket]);
3554 UNLOCK(&adb->entrylocks[bucket]);
3593 int bucket;
3598 bucket = dns_name_hash(name, ISC_FALSE) % NBUCKETS;
3599 LOCK(&adb->namelocks[bucket]);
3600 adbname = ISC_LIST_HEAD(adb->names[bucket]);
3611 UNLOCK(&adb->namelocks[bucket]);