diff options
author | dormando <dormando@rydia.net> | 2017-09-26 14:43:17 -0700 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2017-11-28 14:18:05 -0800 |
commit | f593a59bce69f917514ef6213cf565c71bddcf8c (patch) | |
tree | 4a5dc07433e97b089f46a913b5367aa5d52c059a /slabs.c | |
parent | e6239a905d072e837baa8aa425ca0ccee2fc3e01 (diff) | |
download | memcached-f593a59bce69f917514ef6213cf565c71bddcf8c.tar.gz |
external storage base commit
been squashing reorganizing, and pulling code off to go upstream ahead
of merging the whole branch.
Diffstat (limited to 'slabs.c')
-rw-r--r-- | slabs.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -360,6 +360,9 @@ static void do_slabs_free(void *ptr, const size_t size, unsigned int id) { it = (item *)ptr; if ((it->it_flags & ITEM_CHUNKED) == 0) { +#ifdef EXTSTORE + bool is_hdr = it->it_flags & ITEM_HDR; +#endif it->it_flags = ITEM_SLABBED; it->slabs_clsid = 0; it->prev = 0; @@ -368,7 +371,15 @@ static void do_slabs_free(void *ptr, const size_t size, unsigned int id) { p->slots = it; p->sl_curr++; +#ifdef EXTSTORE + if (!is_hdr) { + p->requested -= size; + } else { + p->requested -= (size - it->nbytes) + sizeof(item_hdr); + } +#else p->requested -= size; +#endif } else { do_slabs_free_chunked(it, size); } @@ -855,6 +866,11 @@ static int slab_rebalance_move(void) { */ /* Check if expired or flushed */ ntotal = ITEM_ntotal(it); +#ifdef EXTSTORE + if (it->it_flags & ITEM_HDR) { + ntotal = (ntotal - it->nbytes) + sizeof(item_hdr); + } +#endif /* REQUIRES slabs_lock: CHECK FOR cls->sl_curr > 0 */ if (ch == NULL && (it->it_flags & ITEM_CHUNKED)) { /* Chunked should be identical to non-chunked, except we need @@ -928,6 +944,7 @@ static int slab_rebalance_move(void) { } else { /* restore ntotal in case we tried saving a head chunk. */ ntotal = ITEM_ntotal(it); + // FIXME: need storage instance to call extstore_delete do_item_unlink(it, hv); slabs_free(it, ntotal, slab_rebal.s_clsid); /* Swing around again later to remove it from the freelist. */ @@ -1027,6 +1044,7 @@ static void slab_rebalance_finish(void) { slab_rebal.d_clsid); } else if (slab_rebal.d_clsid == SLAB_GLOBAL_PAGE_POOL) { /* mem_malloc'ed might be higher than mem_limit. */ + mem_limit_reached = false; memory_release(); } |