提交 a195e51c 编写于 作者: H Hongze Cheng

more work

上级 218ab326
......@@ -22,20 +22,17 @@ struct SPage {
typedef TD_DLIST(SPage) SPgList;
struct SPgCache {
SPage *pages;
SPgList freeList;
SRWLatch mutex;
pgsize_t pgsize;
SPage * pages;
SPgList freeList;
struct {
int32_t nbucket;
struct {
SRWLatch latch;
TD_DLIST(SPage) ht;
} * buckets;
int32_t nbucket;
SPgList *buckets;
} pght; // page hash table
};
int pgCacheCreate(SPgCache **ppPgCache) {
int pgCacheCreate(SPgCache **ppPgCache, pgsize_t pgsize) {
SPgCache *pPgCache;
pPgCache = (SPgCache *)calloc(1, sizeof(*pPgCache));
......@@ -43,6 +40,10 @@ int pgCacheCreate(SPgCache **ppPgCache) {
return -1;
}
pPgCache->pgsize = pgsize;
taosInitRWLatch(&(pPgCache->mutex));
*ppPgCache = pPgCache;
return 0;
}
......
......@@ -24,7 +24,7 @@ typedef struct SPgCache SPgCache;
typedef struct SPage SPage;
// SPgCache
int pgCacheCreate(SPgCache **ppPgCache);
int pgCacheCreate(SPgCache **ppPgCache, pgsize_t pgsize);
int pgCacheDestroy(SPgCache *pPgCache);
int pgCacheOpen(SPgCache *pPgCache);
int pgCacheClose(SPgCache *pPgCache);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册