Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
28e80bf9
Commit
28e80bf9
authored
Jan 13, 2016
by
root
Browse files
fix linux compile bug
parent
152e9f67
Changes
2
Show whitespace changes
Inline
Side-by-side
src/lazyfree.c
View file @
28e80bf9
...
@@ -65,7 +65,7 @@ int dbAsyncDelete(redisDb *db, robj *key) {
...
@@ -65,7 +65,7 @@ int dbAsyncDelete(redisDb *db, robj *key) {
/* If releasing the object is too much work, let's put it into the
/* If releasing the object is too much work, let's put it into the
* lazy free list. */
* lazy free list. */
if
(
free_effort
>
LAZYFREE_THRESHOLD
)
{
if
(
free_effort
>
LAZYFREE_THRESHOLD
)
{
atomicIncr
(
lazyfree_objects
,
1
,
&
lazyfree_objects_mutex
);
atomicIncr
(
lazyfree_objects
,
1
,
lazyfree_objects_mutex
);
bioCreateBackgroundJob
(
BIO_LAZY_FREE
,
val
,
NULL
,
NULL
);
bioCreateBackgroundJob
(
BIO_LAZY_FREE
,
val
,
NULL
,
NULL
);
dictSetVal
(
db
->
dict
,
de
,
NULL
);
dictSetVal
(
db
->
dict
,
de
,
NULL
);
}
}
...
@@ -89,7 +89,7 @@ void emptyDbAsync(redisDb *db) {
...
@@ -89,7 +89,7 @@ void emptyDbAsync(redisDb *db) {
db
->
dict
=
dictCreate
(
&
dbDictType
,
NULL
);
db
->
dict
=
dictCreate
(
&
dbDictType
,
NULL
);
db
->
expires
=
dictCreate
(
&
keyptrDictType
,
NULL
);
db
->
expires
=
dictCreate
(
&
keyptrDictType
,
NULL
);
atomicIncr
(
lazyfree_objects
,
dictSize
(
oldht1
),
atomicIncr
(
lazyfree_objects
,
dictSize
(
oldht1
),
&
lazyfree_objects_mutex
);
lazyfree_objects_mutex
);
bioCreateBackgroundJob
(
BIO_LAZY_FREE
,
NULL
,
oldht1
,
oldht2
);
bioCreateBackgroundJob
(
BIO_LAZY_FREE
,
NULL
,
oldht1
,
oldht2
);
}
}
...
@@ -99,7 +99,7 @@ void slotToKeyFlushAsync(void) {
...
@@ -99,7 +99,7 @@ void slotToKeyFlushAsync(void) {
zskiplist
*
oldsl
=
server
.
cluster
->
slots_to_keys
;
zskiplist
*
oldsl
=
server
.
cluster
->
slots_to_keys
;
server
.
cluster
->
slots_to_keys
=
zslCreate
();
server
.
cluster
->
slots_to_keys
=
zslCreate
();
atomicIncr
(
lazyfree_objects
,
oldsl
->
length
,
atomicIncr
(
lazyfree_objects
,
oldsl
->
length
,
&
lazyfree_objects_mutex
);
lazyfree_objects_mutex
);
bioCreateBackgroundJob
(
BIO_LAZY_FREE
,
NULL
,
NULL
,
oldsl
);
bioCreateBackgroundJob
(
BIO_LAZY_FREE
,
NULL
,
NULL
,
oldsl
);
}
}
...
@@ -107,7 +107,7 @@ void slotToKeyFlushAsync(void) {
...
@@ -107,7 +107,7 @@ void slotToKeyFlushAsync(void) {
* updating the count of objects to release. */
* updating the count of objects to release. */
void
lazyfreeFreeObjectFromBioThread
(
robj
*
o
)
{
void
lazyfreeFreeObjectFromBioThread
(
robj
*
o
)
{
decrRefCount
(
o
);
decrRefCount
(
o
);
atomicDecr
(
lazyfree_objects
,
1
,
&
lazyfree_objects_mutex
);
atomicDecr
(
lazyfree_objects
,
1
,
lazyfree_objects_mutex
);
}
}
/* Release a database from the lazyfree thread. The 'db' pointer is the
/* Release a database from the lazyfree thread. The 'db' pointer is the
...
@@ -119,7 +119,7 @@ void lazyfreeFreeDatabaseFromBioThread(dict *ht1, dict *ht2) {
...
@@ -119,7 +119,7 @@ void lazyfreeFreeDatabaseFromBioThread(dict *ht1, dict *ht2) {
size_t
numkeys
=
dictSize
(
ht1
);
size_t
numkeys
=
dictSize
(
ht1
);
dictRelease
(
ht1
);
dictRelease
(
ht1
);
dictRelease
(
ht2
);
dictRelease
(
ht2
);
atomicDecr
(
lazyfree_objects
,
numkeys
,
&
lazyfree_objects_mutex
);
atomicDecr
(
lazyfree_objects
,
numkeys
,
lazyfree_objects_mutex
);
}
}
/* Release the skiplist mapping Redis Cluster keys to slots in the
/* Release the skiplist mapping Redis Cluster keys to slots in the
...
@@ -127,5 +127,5 @@ void lazyfreeFreeDatabaseFromBioThread(dict *ht1, dict *ht2) {
...
@@ -127,5 +127,5 @@ void lazyfreeFreeDatabaseFromBioThread(dict *ht1, dict *ht2) {
void
lazyfreeFreeSlotsMapFromBioThread
(
zskiplist
*
sl
)
{
void
lazyfreeFreeSlotsMapFromBioThread
(
zskiplist
*
sl
)
{
size_t
len
=
sl
->
length
;
size_t
len
=
sl
->
length
;
zslFree
(
sl
);
zslFree
(
sl
);
atomicDecr
(
lazyfree_objects
,
len
,
&
lazyfree_objects_mutex
);
atomicDecr
(
lazyfree_objects
,
len
,
lazyfree_objects_mutex
);
}
}
src/zmalloc.c
View file @
28e80bf9
...
@@ -72,7 +72,7 @@ void zlibc_free(void *ptr) {
...
@@ -72,7 +72,7 @@ void zlibc_free(void *ptr) {
size_t _n = (__n); \
size_t _n = (__n); \
if (_n&(sizeof(long)-1)) _n += sizeof(long)-(_n&(sizeof(long)-1)); \
if (_n&(sizeof(long)-1)) _n += sizeof(long)-(_n&(sizeof(long)-1)); \
if (zmalloc_thread_safe) { \
if (zmalloc_thread_safe) { \
atomicIncr(used_memory,__n,
&
used_memory_mutex); \
atomicIncr(used_memory,__n,used_memory_mutex); \
} else { \
} else { \
used_memory += _n; \
used_memory += _n; \
} \
} \
...
@@ -82,7 +82,7 @@ void zlibc_free(void *ptr) {
...
@@ -82,7 +82,7 @@ void zlibc_free(void *ptr) {
size_t _n = (__n); \
size_t _n = (__n); \
if (_n&(sizeof(long)-1)) _n += sizeof(long)-(_n&(sizeof(long)-1)); \
if (_n&(sizeof(long)-1)) _n += sizeof(long)-(_n&(sizeof(long)-1)); \
if (zmalloc_thread_safe) { \
if (zmalloc_thread_safe) { \
atomicDecr(used_memory,__n,
&
used_memory_mutex); \
atomicDecr(used_memory,__n,used_memory_mutex); \
} else { \
} else { \
used_memory -= _n; \
used_memory -= _n; \
} \
} \
...
@@ -202,7 +202,7 @@ size_t zmalloc_used_memory(void) {
...
@@ -202,7 +202,7 @@ size_t zmalloc_used_memory(void) {
size_t
um
;
size_t
um
;
if
(
zmalloc_thread_safe
)
{
if
(
zmalloc_thread_safe
)
{
atomicGet
(
used_memory
,
um
,
&
used_memory_mutex
);
atomicGet
(
used_memory
,
um
,
used_memory_mutex
);
}
else
{
}
else
{
um
=
used_memory
;
um
=
used_memory
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment