Home | History | Annotate | Download | only in hash

Lines Matching refs:hashp

86 	_DIAGASSERT((size_t)HASH_BSIZE(hashp) >= temp); \
87 ((uint16_t *)(void *)(P))[1] = (uint16_t)(HASH_BSIZE(hashp) - temp); \
88 ((uint16_t *)(void *)(P))[2] = HASH_BSIZE(hashp); \
133 __delpair(HTAB *hashp, BUFHEAD *bufp, int ndx)
144 return (__big_delete(hashp, bufp));
148 newoff = HASH_BSIZE(hashp);
175 hashp->NKEYS--;
186 __split_page(HTAB *hashp, uint32_t obucket, uint32_t nbucket)
197 copyto = HASH_BSIZE(hashp);
198 off = HASH_BSIZE(hashp);
199 old_bufp = __get_buf(hashp, obucket, NULL, 0);
202 new_bufp = __get_buf(hashp, nbucket, NULL, 0);
216 retval = ugly_split(hashp, obucket, old_bufp, new_bufp,
226 if (__call_hash(hashp, key.data, (int)key.size) == obucket) {
284 HTAB *hashp,
314 if (__big_split(hashp, old_bufp,
343 bufp = __get_buf(hashp, (uint32_t)ov_addr, bufp, 0);
349 scopyto = HASH_BSIZE(hashp);
353 __free_ovflpage(hashp, last_bfp);
357 off = HASH_BSIZE(hashp);
366 if (__call_hash(hashp, key.data, (int)key.size) == obucket) {
372 __add_ovflpage(hashp, old_bufp);
385 __add_ovflpage(hashp, new_bufp);
396 __free_ovflpage(hashp, last_bfp);
408 __addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
422 bufp = __get_buf(hashp, (uint32_t)bp[bp[0] - 1], bufp,
437 bufp = __get_buf(hashp,
449 bufp = __add_ovflpage(hashp, bufp);
457 if (__big_insert(hashp, bufp, key, val))
466 hashp->NKEYS++;
468 (hashp->NKEYS / (hashp->MAX_BUCKET + 1) > hashp->FFACTOR))
469 return (__expand_table(hashp));
480 __add_ovflpage(HTAB *hashp, BUFHEAD *bufp)
491 if (hashp->FFACTOR == DEF_FFACTOR) {
492 hashp->FFACTOR = (uint32_t)sp[0] >> 1;
493 if (hashp->FFACTOR < MIN_FFACTOR)
494 hashp->FFACTOR = MIN_FFACTOR;
497 ovfl_num = overflow_page(hashp);
502 if (!ovfl_num || !(bufp->ovfl = __get_buf(hashp, (uint32_t)ovfl_num,
535 __get_page(HTAB *hashp, char *p, uint32_t bucket, int is_bucket, int is_disk,
543 fd = hashp->fp;
544 size = HASH_BSIZE(hashp);
554 if ((rsize = pread(fd, p, (size_t)size, (off_t)page << hashp->BSHIFT)) == -1)
567 if (hashp->LORDER != BYTE_ORDER) {
571 max = (uint32_t)hashp->BSIZE >> 2; /* divide by 4 */
592 __put_page(HTAB *hashp, char *p, uint32_t bucket, int is_bucket, int is_bitmap)
598 size = HASH_BSIZE(hashp);
599 if ((hashp->fp == -1) && (hashp->fp = __dbtemp("_hash", NULL)) == -1)
601 fd = hashp->fp;
603 if (hashp->LORDER != BYTE_ORDER) {
609 max = (uint32_t)hashp->BSIZE >> 2; /* divide by 4 */
624 if ((wsize = pwrite(fd, p, (size_t)size, (off_t)page << hashp->BSHIFT)) == -1)
640 __ibitmap(HTAB *hashp, int pnum, int nbits, int ndx)
645 if ((ip = malloc((size_t)hashp->BSIZE)) == NULL)
647 hashp->nmaps++;
652 (size_t)(hashp->BSIZE - clearbytes));
655 hashp
656 hashp->mapp[ndx] = ip;
675 overflow_page(HTAB *hashp)
684 splitnum = hashp->OVFL_POINT;
685 max_free = hashp->SPARES[splitnum];
687 free_page = (uint32_t)(max_free - 1) >> (hashp->BSHIFT + BYTE_SHIFT);
688 free_bit = (max_free - 1) & ((hashp->BSIZE << BYTE_SHIFT) - 1);
691 first_page = (uint32_t)hashp->LAST_FREED >>(hashp->BSHIFT + BYTE_SHIFT);
693 if (!(freep = (uint32_t *)hashp->mapp[i]) &&
694 !(freep = fetch_bitmap(hashp, i)))
699 in_use_bits = (hashp->BSIZE << BYTE_SHIFT) - 1;
702 bit = hashp->LAST_FREED &
703 ((hashp->BSIZE << BYTE_SHIFT) - 1);
716 hashp->LAST_FREED = hashp->SPARES[splitnum];
717 hashp->SPARES[splitnum]++;
718 offset = hashp->SPARES[splitnum] -
719 (splitnum ? hashp->SPARES[splitnum - 1] : 0);
728 hashp->OVFL_POINT = splitnum;
729 hashp->SPARES[splitnum] = hashp->SPARES[splitnum-1];
730 hashp->SPARES[splitnum-1]--;
735 if (free_bit == (hashp->BSIZE << BYTE_SHIFT) - 1) {
753 if (__ibitmap(hashp,
756 hashp->SPARES[splitnum]++;
768 hashp->OVFL_POINT = splitnum;
769 hashp->SPARES[splitnum] = hashp->SPARES[splitnum-1];
770 hashp->SPARES[splitnum-1]--;
802 bit = 1 + bit + (i * (hashp->BSIZE << BYTE_SHIFT));
803 if (bit >= hashp->LAST_FREED)
804 hashp->LAST_FREED = bit - 1;
807 for (i = 0; (i < splitnum) && (bit > hashp->SPARES[i]); i++);
808 offset = (i ? bit - hashp->SPARES[i - 1] : bit);
828 __free_ovflpage(HTAB *hashp, BUFHEAD *obufp)
841 (ndx ? hashp->SPARES[ndx - 1] : 0) + (addr & SPLITMASK) - 1;
842 if (bit_address < hashp->LAST_FREED)
843 hashp->LAST_FREED = bit_address;
844 free_page = ((uint32_t)bit_address >> (hashp->BSHIFT + BYTE_SHIFT));
845 free_bit = bit_address & ((hashp->BSIZE << BYTE_SHIFT) - 1);
847 if (!(freep = hashp->mapp[free_page]))
848 freep = fetch_bitmap(hashp, free_page);
860 __reclaim_buf(hashp, obufp);
898 fetch_bitmap(HTAB *hashp, int ndx)
900 if (ndx >= hashp->nmaps)
902 if ((hashp->mapp[ndx] = malloc((size_t)hashp->BSIZE)) == NULL)
904 if (__get_page(hashp,
905 (char *)(void *)hashp->mapp[ndx], (uint32_t)hashp->BITMAPS[ndx], 0, 1, 1)) {
906 free(hashp->mapp[ndx]);
909 return (hashp->mapp[ndx]);
915 print_chain(HTAB *hashp, uint32_t addr)
921 bufp = __get_buf(hashp, addr, NULL, 0);
927 bufp = __get_buf(hashp, (uint32_t)oaddr, bufp, 0);