|
|
|
|
@ -33,6 +33,14 @@ |
|
|
|
|
#include "cache.h" |
|
|
|
|
#include "fmap.h" |
|
|
|
|
|
|
|
|
|
#ifdef CL_THREAD_SAFE |
|
|
|
|
static pthread_mutex_t pool_mutex = PTHREAD_MUTEX_INITIALIZER; |
|
|
|
|
#else |
|
|
|
|
#define pthread_mutex_lock(x) 0 |
|
|
|
|
#define pthread_mutex_unlock(x) |
|
|
|
|
#define pthread_mutex_init(a, b) 0 |
|
|
|
|
#define pthread_mutex_destroy(a) do { } while(0) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
/* The number of root trees and the chooser function
|
|
|
|
|
Each tree is protected by a mutex against concurrent access */ |
|
|
|
|
@ -158,14 +166,6 @@ static inline void lru_addtail(struct cache_set *map, struct cache_key *newkey) |
|
|
|
|
map->lru_tail = newkey; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifdef CL_THREAD_SAFE |
|
|
|
|
static pthread_mutex_t pool_mutex = PTHREAD_MUTEX_INITIALIZER; |
|
|
|
|
#else |
|
|
|
|
#define pthread_mutex_lock(x) 0 |
|
|
|
|
#define pthread_mutex_unlock(x) |
|
|
|
|
#define pthread_mutex_init(a, b) 0 |
|
|
|
|
#define pthread_mutex_destroy do { } while(0) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
static void cacheset_add(struct cache_set *map, unsigned char *md5, size_t size, mpool_t *mempool); |
|
|
|
|
static int cacheset_init(struct cache_set *map, mpool_t *mempool); |
|
|
|
|
|