diff --git a/source/libs/tdb/inc/tdb.h b/source/libs/tdb/inc/tdb.h index 9a168c53117f93ff38e9cd6add5b076d4d0ce884..daffad3b7946f51eb74d48b4b500b4d1838abe0d 100644 --- a/source/libs/tdb/inc/tdb.h +++ b/source/libs/tdb/inc/tdb.h @@ -26,7 +26,7 @@ typedef struct STDb TDB; typedef struct STDbEnv TENV; typedef struct STDbCurosr TDBC; -typedef int32_t pgsize_t; +typedef int32_t pgsz_t; typedef int32_t cachesz_t; // TEVN @@ -34,9 +34,9 @@ int tdbEnvCreate(TENV **ppEnv); int tdbEnvOpen(TENV **ppEnv); int tdbEnvClose(TENV *pEnv); -int tdbEnvSetPageSize(TENV *pEnv, pgsize_t szPage); +int tdbEnvSetPageSize(TENV *pEnv, pgsz_t szPage); int tdbEnvSetCacheSize(TENV *pEnv, cachesz_t szCache); -pgsize_t tdbEnvGetPageSize(TENV *pEnv); +pgsz_t tdbEnvGetPageSize(TENV *pEnv); cachesz_t tdbEnvGetCacheSize(TENV *pEnv); // TDB diff --git a/source/libs/tdb/src/db/btree.c b/source/libs/tdb/src/db/btree.c index 8e308b63b94ec975f3807cc5a34979c7d22dbc0b..400d91514dc02c734f8cf406aebd8a6f2f2ff540 100644 --- a/source/libs/tdb/src/db/btree.c +++ b/source/libs/tdb/src/db/btree.c @@ -22,8 +22,8 @@ struct SBtCursor { }; typedef struct { - pgno_t pgno; - pgsize_t offset; + pgno_t pgno; + pgsz_t offset; } SBtIdx; static int btreeCreate(SBTree **pBt); diff --git a/source/libs/tdb/src/db/pgcache.c b/source/libs/tdb/src/db/pgcache.c index b0c4406a3c509f058532846f8b50a2206caaa3d4..9e66a5a9609207ec0792e8f004504b23ffdefdc5 100644 --- a/source/libs/tdb/src/db/pgcache.c +++ b/source/libs/tdb/src/db/pgcache.c @@ -17,7 +17,7 @@ static void pgCachePinPage(SPage *pPage); static void pgCacheUnpinPage(SPage *pPage); -int pgCacheCreate(SPgCache **ppPgCache, pgsize_t pgSize, int32_t npage) { +int pgCacheCreate(SPgCache **ppPgCache, pgsz_t pgSize, int32_t npage) { SPgCache *pPgCache; SPage * pPage; diff --git a/source/libs/tdb/src/db/pgfile.c b/source/libs/tdb/src/db/pgfile.c index 7f0ab55b000eb7f4f072300e44a6f11987b8ad43..c03303da384643d5eb9908add4de22b3fd009120 100644 --- a/source/libs/tdb/src/db/pgfile.c +++ b/source/libs/tdb/src/db/pgfile.c @@ -107,7 +107,7 @@ int pgFileWrite(SPage *pPage) { } static int pgFileRead(SPgFile *pPgFile, pgno_t pgno, uint8_t *pData) { - pgsize_t pgSize; + pgsz_t pgSize; ssize_t rsize; uint8_t *pTData; size_t szToRead; diff --git a/source/libs/tdb/src/db/tdbEnv.c b/source/libs/tdb/src/db/tdbEnv.c index fe9238e1eb850621d21a5f1e33a7a7dd7e794926..cbc1ef341795618b7097e406a5ebbeba69b5823e 100644 --- a/source/libs/tdb/src/db/tdbEnv.c +++ b/source/libs/tdb/src/db/tdbEnv.c @@ -16,7 +16,7 @@ #include "tdbInt.h" struct STDbEnv { - pgsize_t pgSize; // Page size + pgsz_t pgSize; // Page size cachesz_t cacheSize; // Total cache size STDbList dbList; // TDB List SPgFileList pgfList; // SPgFile List @@ -74,7 +74,7 @@ int tdbEnvClose(TENV *pEnv) { return 0; } -int tdbEnvSetPageSize(TENV *pEnv, pgsize_t szPage) { +int tdbEnvSetPageSize(TENV *pEnv, pgsz_t szPage) { /* TODO */ pEnv->pgSize = szPage; return 0; @@ -86,7 +86,7 @@ int tdbEnvSetCacheSize(TENV *pEnv, cachesz_t szCache) { return 0; } -pgsize_t tdbEnvGetPageSize(TENV *pEnv) { return pEnv->pgSize; } +pgsz_t tdbEnvGetPageSize(TENV *pEnv) { return pEnv->pgSize; } cachesz_t tdbEnvGetCacheSize(TENV *pEnv) { return pEnv->cacheSize; } diff --git a/source/libs/tdb/src/db/tdb_mpool.c b/source/libs/tdb/src/db/tdb_mpool.c index cc7927d51b0256de3f0edb6ccc0e401647d75f14..2049019970f83e58c3b28d19b8de1ced93f42f96 100644 --- a/source/libs/tdb/src/db/tdb_mpool.c +++ b/source/libs/tdb/src/db/tdb_mpool.c @@ -22,7 +22,7 @@ static int tdbMPoolFileReadPage(TDB_MPFILE *mpf, pgno_t pgno, void *p); static int tdbMPoolFileWritePage(TDB_MPFILE *mpf, pgno_t pgno, const void *p); static void tdbMPoolClockEvictPage(TDB_MPOOL *mp, pg_t **pagepp); -int tdbMPoolOpen(TDB_MPOOL **mpp, uint64_t cachesize, pgsize_t pgsize) { +int tdbMPoolOpen(TDB_MPOOL **mpp, uint64_t cachesize, pgsz_t pgsize) { TDB_MPOOL *mp = NULL; size_t tsize; pg_t * pagep; @@ -300,7 +300,7 @@ static void tdbMPoolUnregFile(TDB_MPOOL *mp, TDB_MPFILE *mpf) { } static int tdbMPoolFileReadPage(TDB_MPFILE *mpf, pgno_t pgno, void *p) { - pgsize_t pgsize; + pgsz_t pgsize; TDB_MPOOL *mp; off_t offset; size_t rsize; @@ -317,7 +317,7 @@ static int tdbMPoolFileReadPage(TDB_MPFILE *mpf, pgno_t pgno, void *p) { } static int tdbMPoolFileWritePage(TDB_MPFILE *mpf, pgno_t pgno, const void *p) { - pgsize_t pgsize; + pgsz_t pgsize; TDB_MPOOL *mp; off_t offset; diff --git a/source/libs/tdb/src/inc/pgcache.h b/source/libs/tdb/src/inc/pgcache.h index 9296e0bea13be39eb3daa351e9e9a22aaf1844a9..4cea86dc6d06cc8fe878ef35eb7c073e31ed5739 100644 --- a/source/libs/tdb/src/inc/pgcache.h +++ b/source/libs/tdb/src/inc/pgcache.h @@ -24,7 +24,7 @@ typedef struct SPgCache SPgCache; typedef struct SPage SPage; // SPgCache -int pgCacheCreate(SPgCache **ppPgCache, pgsize_t pgSize, int32_t npage); +int pgCacheCreate(SPgCache **ppPgCache, pgsz_t pgSize, int32_t npage); int pgCacheDestroy(SPgCache *pPgCache); int pgCacheOpen(SPgCache **ppPgCache); int pgCacheClose(SPgCache *pPgCache); @@ -46,9 +46,9 @@ struct SPage { typedef TD_DLIST(SPage) SPgList; struct SPgCache { - TENV * pEnv; // TENV containing this page cache + TENV * pEnv; // TENV containing this page cache SRWLatch mutex; - pgsize_t pgsize; + pgsz_t pgsize; int32_t npage; SPage * pages; SPgList freeList; diff --git a/source/libs/tdb/src/inc/pgfile.h b/source/libs/tdb/src/inc/pgfile.h index f248f3c953696ef3b53e90dfa67eab83301a2038..f2dba417f6a043a998849522eb9add4844370afd 100644 --- a/source/libs/tdb/src/inc/pgfile.h +++ b/source/libs/tdb/src/inc/pgfile.h @@ -24,7 +24,7 @@ struct SPgFile { char * fname; // backend file name uint8_t fileid[TDB_FILE_ID_LEN]; // file id SPgCache *pPgCache; // page cache underline - pgsize_t pgSize; + pgsz_t pgSize; int fd; pgno_t pgFileSize; }; diff --git a/source/libs/tdb/src/inc/tdbInt.h b/source/libs/tdb/src/inc/tdbInt.h index 879a4f4f669ea17254e892e895ccc4f37f9f4df4..5b95e162032508e53d79c1359e016492ae762d1c 100644 --- a/source/libs/tdb/src/inc/tdbInt.h +++ b/source/libs/tdb/src/inc/tdbInt.h @@ -64,9 +64,9 @@ static FORCE_INLINE int tdbCmprPgId(const void *p1, const void *p2) { // framd_id_t typedef int32_t frame_id_t; -// pgsize_t +// pgsz_t #define TDB_MIN_PGSIZE 512 -#define TDB_MAX_PGSIZE 16384 +#define TDB_MAX_PGSIZE 65536 #define TDB_DEFAULT_PGSIZE 4096 #define TDB_IS_PGSIZE_VLD(s) (((s) >= TDB_MIN_PGSIZE) && ((s) <= TDB_MAX_PGSIZE)) diff --git a/source/libs/tdb/src/inc/tdb_mpool.h b/source/libs/tdb/src/inc/tdb_mpool.h index 55754484c07cd8d29de6ee45c8ea608c0d68a39a..ba5d5f132ed3438b04e083acda279b0822ea2019 100644 --- a/source/libs/tdb/src/inc/tdb_mpool.h +++ b/source/libs/tdb/src/inc/tdb_mpool.h @@ -46,7 +46,7 @@ typedef struct { } mpf_bucket_t; struct TDB_MPOOL { int64_t cachesize; - pgsize_t pgsize; + pgsz_t pgsize; int32_t npages; pg_t * pages; pg_list_t freeList; @@ -74,7 +74,7 @@ struct TDB_MPFILE { /*=================================================== Exposed apis ==================================================*/ // TDB_MPOOL -int tdbMPoolOpen(TDB_MPOOL **mpp, uint64_t cachesize, pgsize_t pgsize); +int tdbMPoolOpen(TDB_MPOOL **mpp, uint64_t cachesize, pgsz_t pgsize); int tdbMPoolClose(TDB_MPOOL *mp); int tdbMPoolSync(TDB_MPOOL *mp);