Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
970e10bb
Commit
970e10bb
authored
Jan 19, 2010
by
antirez
Browse files
removed a bug in the function to cancel an I/O job
parent
33843a90
Changes
3
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
970e10bb
...
...
@@ -15,26 +15,33 @@ CCOPT= $(CFLAGS) $(CCLINK) $(ARCH) $(PROF)
DEBUG
?=
-g
-rdynamic
-ggdb
OBJ
=
adlist.o ae.o anet.o dict.o redis.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o
BENCHOBJ
=
ae.o anet.o benchmark.o sds.o adlist.o zmalloc.o
BENCHOBJ
=
ae.o anet.o
redis-
benchmark.o sds.o adlist.o zmalloc.o
CLIOBJ
=
anet.o sds.o adlist.o redis-cli.o zmalloc.o
LOADOBJ
=
ae.o anet.o redis-load.o sds.o adlist.o zmalloc.o
PRGNAME
=
redis-server
BENCHPRGNAME
=
redis-benchmark
CLIPRGNAME
=
redis-cli
LOADPRGNAME
=
redis-load
all
:
redis-server redis-benchmark redis-cli
cotools
:
redis-load
# Deps (use make dep to generate this)
adlist.o
:
adlist.c adlist.h zmalloc.h
ae.o
:
ae.c ae.h zmalloc.h ae_select.c ae_epoll.c
ae.o
:
ae.c ae.h zmalloc.h config.h ae_kqueue.c
ae_epoll.o
:
ae_epoll.c
ae_kqueue.o
:
ae_kqueue.c
ae_select.o
:
ae_select.c
anet.o
:
anet.c fmacros.h anet.h
benchmark.o
:
benchmark.c fmacros.h ae.h anet.h sds.h adlist.h zmalloc.h
dict.o
:
dict.c fmacros.h dict.h zmalloc.h
lzf_c.o
:
lzf_c.c lzfP.h
lzf_d.o
:
lzf_d.c lzfP.h
pqsort.o
:
pqsort.c
redis-benchmark.o
:
redis-benchmark.c fmacros.h ae.h anet.h sds.h adlist.h
\
zmalloc.h
redis-cli.o
:
redis-cli.c fmacros.h anet.h sds.h adlist.h zmalloc.h
redis-load.o
:
redis-load.c fmacros.h ae.h anet.h sds.h adlist.h zmalloc.h
redis.o
:
redis.c fmacros.h config.h redis.h ae.h sds.h anet.h dict.h
\
adlist.h zmalloc.h lzf.h pqsort.h staticsymbols.h
sds.o
:
sds.c sds.h zmalloc.h
...
...
@@ -54,11 +61,14 @@ redis-benchmark: $(BENCHOBJ)
redis-cli
:
$(CLIOBJ)
$(CC)
-o
$(CLIPRGNAME)
$(CCOPT)
$(DEBUG)
$(CLIOBJ)
redis-load
:
$(LOADOBJ)
$(CC)
-o
$(LOADPRGNAME)
$(CCOPT)
$(DEBUG)
$(LOADOBJ)
.c.o
:
$(CC)
-c
$(CFLAGS)
$(DEBUG)
$(COMPILE_TIME)
$<
clean
:
rm
-rf
$(PRGNAME)
$(BENCHPRGNAME)
$(CLIPRGNAME)
*
.o
*
.gcda
*
.gcno
*
.gcov
rm
-rf
$(PRGNAME)
$(BENCHPRGNAME)
$(CLIPRGNAME)
$(LOADPRGNAME)
*
.o
*
.gcda
*
.gcno
*
.gcov
dep
:
$(CC)
-MM
*
.c
...
...
benchmark.c
→
redis-
benchmark.c
View file @
970e10bb
File moved
redis.c
View file @
970e10bb
...
...
@@ -566,6 +566,7 @@ static int vmWriteObjectOnSwap(robj *o, off_t page);
static robj *vmReadObjectFromSwap(off_t page, int type);
static void waitEmptyIOJobsQueue(void);
static void vmReopenSwapFile(void);
static int vmFreePage(off_t page);
static void authCommand(redisClient *c);
static void pingCommand(redisClient *c);
...
...
@@ -2498,7 +2499,8 @@ static void incrRefCount(robj *o) {
static void decrRefCount(void *obj) {
robj *o = obj;
/* Object is swapped out, or in the process of being loaded. */
/* Object is a key of a swapped out value, or in the process of being
* loaded. */
if (server.vm_enabled &&
(o->storage == REDIS_VM_SWAPPED || o->storage == REDIS_VM_LOADING))
{
...
...
@@ -7092,6 +7094,7 @@ static void vmInit(void) {
static void vmMarkPageUsed(off_t page) {
off_t byte = page/8;
int bit = page&7;
redisAssert(vmFreePage(page) == 1);
server.vm_bitmap[byte] |= 1<<bit;
redisLog(REDIS_DEBUG,"Mark used: %lld (byte:%lld bit:%d)\n",
(long long)page, (long long)byte, bit);
...
...
@@ -7110,7 +7113,10 @@ static void vmMarkPagesUsed(off_t page, off_t count) {
static void vmMarkPageFree(off_t page) {
off_t byte = page/8;
int bit = page&7;
redisAssert(vmFreePage(page) == 0);
server.vm_bitmap[byte] &= ~(1<<bit);
redisLog(REDIS_DEBUG,"Mark free: %lld (byte:%lld bit:%d)\n",
(long long)page, (long long)byte, bit);
}
/* Mark N contiguous pages as free, with 'page' being the first. */
...
...
@@ -7120,6 +7126,9 @@ static void vmMarkPagesFree(off_t page, off_t count) {
for (j = 0; j < count; j++)
vmMarkPageFree(page+j);
server.vm_stats_used_pages -= count;
if (server.vm_stats_used_pages > 100000000) {
*((char*)-1) = 'x';
}
}
/* Test if the page is free */
...
...
@@ -7640,11 +7649,11 @@ again:
if (job->canceled) continue; /* Skip this, already canceled. */
if (compareStringObjects(job->key,o) == 0) {
redisLog(REDIS_DEBUG,"*** CANCELED %p (%s) (LIST ID %d)\n",
(void*)job, (char*)o->ptr, i);
redisLog(REDIS_DEBUG,"*** CANCELED %p (%s)
(type %d)
(LIST ID %d)\n",
(void*)job, (char*)o->ptr,
job->type,
i);
/* Mark the pages as free since the swap didn't happened
* or happened but is now discarded. */
if (job->type == REDIS_IOJOB_DO_SWAP)
if (
i != 1 &&
job->type == REDIS_IOJOB_DO_SWAP)
vmMarkPagesFree(job->page,job->pages);
/* Cancel the job. It depends on the list the job is
* living in. */
...
...
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