diff options
Diffstat (limited to 'src/defrag.c')
-rw-r--r-- | src/defrag.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/defrag.c b/src/defrag.c index 07a16ca6c..04ade30ea 100644 --- a/src/defrag.c +++ b/src/defrag.c @@ -47,11 +47,11 @@ int je_get_defrag_hint(void* ptr); /* forward declarations*/ void defragDictBucketCallback(void *privdata, dictEntry **bucketref); -dictEntry* replaceSateliteDictKeyPtrAndOrDefragDictEntry(dict *d, sds oldkey, sds newkey, uint64_t hash, long *defragged); +dictEntry* replaceSatelliteDictKeyPtrAndOrDefragDictEntry(dict *d, sds oldkey, sds newkey, uint64_t hash, long *defragged); /* Defrag helper for generic allocations. * - * returns NULL in case the allocatoin wasn't moved. + * returns NULL in case the allocation wasn't moved. * when it returns a non-null value, the old pointer was already released * and should NOT be accessed. */ void* activeDefragAlloc(void *ptr) { @@ -74,7 +74,7 @@ void* activeDefragAlloc(void *ptr) { /*Defrag helper for sds strings * - * returns NULL in case the allocatoin wasn't moved. + * returns NULL in case the allocation wasn't moved. * when it returns a non-null value, the old pointer was already released * and should NOT be accessed. */ sds activeDefragSds(sds sdsptr) { @@ -90,7 +90,7 @@ sds activeDefragSds(sds sdsptr) { /* Defrag helper for robj and/or string objects * - * returns NULL in case the allocatoin wasn't moved. + * returns NULL in case the allocation wasn't moved. * when it returns a non-null value, the old pointer was already released * and should NOT be accessed. */ robj *activeDefragStringOb(robj* ob, long *defragged) { @@ -130,11 +130,11 @@ robj *activeDefragStringOb(robj* ob, long *defragged) { } /* Defrag helper for dictEntries to be used during dict iteration (called on - * each step). Teturns a stat of how many pointers were moved. */ + * each step). Returns a stat of how many pointers were moved. */ long dictIterDefragEntry(dictIterator *iter) { /* This function is a little bit dirty since it messes with the internals * of the dict and it's iterator, but the benefit is that it is very easy - * to use, and require no other chagnes in the dict. */ + * to use, and require no other changes in the dict. */ long defragged = 0; dictht *ht; /* Handle the next entry (if there is one), and update the pointer in the @@ -238,7 +238,7 @@ double *zslDefrag(zskiplist *zsl, double score, sds oldele, sds newele) { return NULL; } -/* Defrag helpler for sorted set. +/* Defrag helper for sorted set. * Defrag a single dict entry key name, and corresponding skiplist struct */ long activeDefragZsetEntry(zset *zs, dictEntry *de) { sds newsds; @@ -349,7 +349,7 @@ long activeDefragSdsListAndDict(list *l, dict *d, int dict_val_type) { if ((newsds = activeDefragSds(sdsele))) { /* When defragging an sds value, we need to update the dict key */ uint64_t hash = dictGetHash(d, newsds); - replaceSateliteDictKeyPtrAndOrDefragDictEntry(d, sdsele, newsds, hash, &defragged); + replaceSatelliteDictKeyPtrAndOrDefragDictEntry(d, sdsele, newsds, hash, &defragged); ln->value = newsds; defragged++; } @@ -385,7 +385,7 @@ long activeDefragSdsListAndDict(list *l, dict *d, int dict_val_type) { * moved. Return value is the the dictEntry if found, or NULL if not found. * NOTE: this is very ugly code, but it let's us avoid the complication of * doing a scan on another dict. */ -dictEntry* replaceSateliteDictKeyPtrAndOrDefragDictEntry(dict *d, sds oldkey, sds newkey, uint64_t hash, long *defragged) { +dictEntry* replaceSatelliteDictKeyPtrAndOrDefragDictEntry(dict *d, sds oldkey, sds newkey, uint64_t hash, long *defragged) { dictEntry **deref = dictFindEntryRefByPtrAndHash(d, oldkey, hash); if (deref) { dictEntry *de = *deref; @@ -433,7 +433,7 @@ long activeDefragQuickListNodes(quicklist *ql) { } /* when the value has lots of elements, we want to handle it later and not as - * oart of the main dictionary scan. this is needed in order to prevent latency + * part of the main dictionary scan. this is needed in order to prevent latency * spikes when handling large items */ void defragLater(redisDb *db, dictEntry *kde) { sds key = sdsdup(dictGetKey(kde)); @@ -814,7 +814,7 @@ long defragKey(redisDb *db, dictEntry *de) { * I can't search in db->expires for that key after i already released * the pointer it holds it won't be able to do the string compare */ uint64_t hash = dictGetHash(db->dict, de->key); - replaceSateliteDictKeyPtrAndOrDefragDictEntry(db->expires, keysds, newsds, hash, &defragged); + replaceSatelliteDictKeyPtrAndOrDefragDictEntry(db->expires, keysds, newsds, hash, &defragged); } /* Try to defrag robj and / or string value. */ @@ -885,7 +885,7 @@ void defragScanCallback(void *privdata, const dictEntry *de) { server.stat_active_defrag_scanned++; } -/* Defrag scan callback for each hash table bicket, +/* Defrag scan callback for each hash table bucket, * used in order to defrag the dictEntry allocations. */ void defragDictBucketCallback(void *privdata, dictEntry **bucketref) { UNUSED(privdata); /* NOTE: this function is also used by both activeDefragCycle and scanLaterHash, etc. don't use privdata */ @@ -919,7 +919,7 @@ float getAllocatorFragmentation(size_t *out_frag_bytes) { return frag_pct; } -/* We may need to defrag other globals, one small allcation can hold a full allocator run. +/* We may need to defrag other globals, one small allocation can hold a full allocator run. * so although small, it is still important to defrag these */ long defragOtherGlobals() { long defragged = 0; @@ -1090,7 +1090,7 @@ void activeDefragCycle(void) { if (hasActiveChildProcess()) return; /* Defragging memory while there's a fork will just do damage. */ - /* Once a second, check if we the fragmentation justfies starting a scan + /* Once a second, check if the fragmentation justfies starting a scan * or making it more aggressive. */ run_with_period(1000) { computeDefragCycles(); @@ -1160,7 +1160,7 @@ void activeDefragCycle(void) { * (if we have a lot of pointers in one hash bucket or rehasing), * check if we reached the time limit. * But regardless, don't start a new db in this loop, this is because after - * the last db we call defragOtherGlobals, which must be done in once cycle */ + * the last db we call defragOtherGlobals, which must be done in one cycle */ if (!cursor || (++iterations > 16 || server.stat_active_defrag_hits - prev_defragged > 512 || server.stat_active_defrag_scanned - prev_scanned > 64)) { |