Changeset 591
- Timestamp:
- 07/09/07 14:28:54 (2 years ago)
- Files:
-
- trunk/server/assoc.c (modified) (10 diffs)
- trunk/server/items.c (modified) (8 diffs)
- trunk/server/slabs.c (modified) (1 diff)
- trunk/server/stats.c (modified) (1 diff)
- trunk/server/thread.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/server/assoc.c
r551 r591 154 154 #ifdef VALGRIND 155 155 const uint8_t *k8; 156 #endif / / ifdef VALGRIND156 #endif /* ifdef VALGRIND */ 157 157 158 158 /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ … … 332 332 #ifdef VALGRIND 333 333 const uint8_t *k8; 334 #endif / / ifdef VALGRIND334 #endif /* ifdef VALGRIND */ 335 335 336 336 /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ … … 450 450 451 451 /* how many powers of 2's worth of buckets we use */ 452 static int hashpower = 16;452 static unsigned int hashpower = 16; 453 453 454 454 #define hashsize(n) ((ub4)1<<(n)) … … 465 465 466 466 /* Number of items in the hash table. */ 467 static int hash_items = 0;467 static unsigned int hash_items = 0; 468 468 469 469 /* Flag: Are we in the middle of expanding now? */ 470 static int expanding = 0;470 static bool expanding = false; 471 471 472 472 /* … … 474 474 * far we've gotten so far. Ranges from 0 .. hashsize(hashpower - 1) - 1. 475 475 */ 476 static int expand_bucket = 0;476 static unsigned int expand_bucket = 0; 477 477 478 478 void assoc_init(void) { … … 489 489 uint32_t hv = hash(key, nkey, 0); 490 490 item *it; 491 int oldbucket;491 unsigned int oldbucket; 492 492 493 493 if (expanding && … … 515 515 uint32_t hv = hash(key, nkey, 0); 516 516 item **pos; 517 int oldbucket;517 unsigned int oldbucket; 518 518 519 519 if (expanding && … … 540 540 fprintf(stderr, "Hash table expansion starting\n"); 541 541 hashpower++; 542 expanding = 1;542 expanding = true; 543 543 expand_bucket = 0; 544 544 do_assoc_move_next_bucket(); … … 567 567 expand_bucket++; 568 568 if (expand_bucket == hashsize(hashpower - 1)) { 569 expanding = 0;569 expanding = false; 570 570 free(old_hashtable); 571 571 if (settings.verbose > 1) … … 578 578 int assoc_insert(item *it) { 579 579 uint32_t hv; 580 int oldbucket;580 unsigned int oldbucket; 581 581 582 582 assert(assoc_find(ITEM_key(it), it->nkey) == 0); /* shouldn't have duplicately named things defined */ trunk/server/items.c
r590 r591 52 52 #endif 53 53 54 /* 54 /** 55 55 * Generates the variable-sized part of the header for an object. 56 56 * … … 151 151 } 152 152 153 /* 153 /** 154 154 * Returns true if an item will fit in the cache (its size does not exceed 155 155 * the maximum for a cache entry.) … … 268 268 /*@null@*/ 269 269 char *do_item_cachedump(const unsigned int slabs_clsid, const unsigned int limit, unsigned int *bytes) { 270 int memlimit = 2 * 1024 * 1024; /* 2MB max response size */270 unsigned int memlimit = 2 * 1024 * 1024; /* 2MB max response size */ 271 271 char *buffer; 272 272 unsigned int bufcurr; 273 273 item *it; 274 int len;275 int shown = 0;274 unsigned int len; 275 unsigned int shown = 0; 276 276 char temp[512]; 277 277 … … 333 333 } 334 334 335 /* dumps out a list of objects of each size, with granularity of 32 bytes */335 /** dumps out a list of objects of each size, with granularity of 32 bytes */ 336 336 /*@null@*/ 337 337 char* do_item_stats_sizes(int *bytes) { … … 372 372 } 373 373 374 /* returns true if a deleted item's delete-locked-time is over, and it375 should be removed from the namespace */374 /** returns true if a deleted item's delete-locked-time is over, and it 375 should be removed from the namespace */ 376 376 bool item_delete_lock_over (item *it) { 377 377 assert(it->it_flags & ITEM_DELETED); … … 379 379 } 380 380 381 /* wrapper around assoc_find which does the lazy expiration/deletion logic */381 /** wrapper around assoc_find which does the lazy expiration/deletion logic */ 382 382 item *do_item_get_notedeleted(const char *key, const size_t nkey, bool *delete_locked) { 383 383 item *it = assoc_find(key, nkey); … … 394 394 if (it != NULL && settings.oldest_live != 0 && settings.oldest_live <= current_time && 395 395 it->time <= settings.oldest_live) { 396 do_item_unlink(it); / / MTSAFE - cache_lock held396 do_item_unlink(it); /* MTSAFE - cache_lock held */ 397 397 it = 0; 398 398 } 399 399 if (it != NULL && it->exptime != 0 && it->exptime <= current_time) { 400 do_item_unlink(it); / / MTSAFE - cache_lock held400 do_item_unlink(it); /* MTSAFE - cache_lock held */ 401 401 it = 0; 402 402 } … … 413 413 } 414 414 415 /* returns an item whether or not it's delete-locked or expired. */415 /** returns an item whether or not it's delete-locked or expired. */ 416 416 item *do_item_get_nocheck(const char *key, const size_t nkey) { 417 417 item *it = assoc_find(key, nkey); trunk/server/slabs.c
r551 r591 89 89 } 90 90 91 /* 91 /** 92 92 * Determines the chunk sizes and initializes the slab class descriptors 93 93 * accordingly. trunk/server/stats.c
r515 r591 99 99 100 100 strncpy(pfs->prefix, key, length); 101 pfs->prefix[length] = '\0'; / / because strncpy() sucks101 pfs->prefix[length] = '\0'; /* because strncpy() sucks */ 102 102 pfs->prefix_len = length; 103 103 trunk/server/thread.c
r590 r591 633 633 /* Wait for all the threads to set themselves up before returning. */ 634 634 pthread_mutex_lock(&init_lock); 635 init_count++; / / main thread635 init_count++; /* main thread */ 636 636 while (init_count < nthreads) { 637 637 pthread_cond_wait(&init_cond, &init_lock);
