Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
04c83f49
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
04c83f49
编写于
12月 13, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more
上级
0eff683d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
26 addition
and
30 deletion
+26
-30
include/util/tdlist.h
include/util/tdlist.h
+15
-24
source/dnode/vnode/impl/src/vnodeArenaMAImpl.c
source/dnode/vnode/impl/src/vnodeArenaMAImpl.c
+4
-2
source/dnode/vnode/impl/src/vnodeBufferPool.c
source/dnode/vnode/impl/src/vnodeBufferPool.c
+6
-3
source/dnode/vnode/impl/test/vnodeApiTests.cpp
source/dnode/vnode/impl/test/vnodeApiTests.cpp
+1
-1
未找到文件。
include/util/tdlist.h
浏览文件 @
04c83f49
...
...
@@ -65,30 +65,21 @@ extern "C" {
} \
(l)->neles_ += 1;
#define tlistPop(l, n) \
({ \
if ((n)) { \
if ((l)->head_ == (n)) { \
(l)->head_ = (n)->next_; \
} \
if ((l)->tail_ == (n)) { \
(l)->tail_ = (n)->prev_; \
} \
if ((n)->prev_ != NULL) { \
(n)->prev_->next_ = (n)->next_; \
} \
if ((n)->next_ != NULL) { \
(n)->next_->prev_ = (n)->prev_; \
} \
(l)->neles_ -= 1; \
(n)->prev_ = (n)->next_ = NULL; \
} \
(n); \
})
#define tlistPopHead(l) tlistPop(l, (l)->head_)
#define tlistPopTail(l) tlistPop(l, (l)->tail_)
#define tlistPop(l, n) \
if ((l)->head_ == (n)) { \
(l)->head_ = (n)->next_; \
} \
if ((l)->tail_ == (n)) { \
(l)->tail_ = (n)->prev_; \
} \
if ((n)->prev_ != NULL) { \
(n)->prev_->next_ = (n)->next_; \
} \
if ((n)->next_ != NULL) { \
(n)->next_->prev_ = (n)->prev_; \
} \
(l)->neles_ -= 1; \
(n)->prev_ = (n)->next_ = NULL;
// List iterator
#define TD_LIST_FITER 0
...
...
source/dnode/vnode/impl/src/vnodeArenaMAImpl.c
浏览文件 @
04c83f49
...
...
@@ -43,9 +43,10 @@ SVMemAllocator *vmaCreate(uint64_t capacity, uint64_t ssize, uint64_t lsize) {
void
vmaDestroy
(
SVMemAllocator
*
pVMA
)
{
if
(
pVMA
)
{
while
(
true
)
{
SVArenaNode
*
pNode
=
tlist
Pop
Tail
(
&
(
pVMA
->
nlist
));
SVArenaNode
*
pNode
=
tlistTail
(
&
(
pVMA
->
nlist
));
if
(
pNode
)
{
tlistPop
(
&
(
pVMA
->
nlist
),
pNode
);
vArenaNodeFree
(
pNode
);
}
else
{
break
;
...
...
@@ -58,7 +59,8 @@ void vmaDestroy(SVMemAllocator *pVMA) {
void
vmaReset
(
SVMemAllocator
*
pVMA
)
{
while
(
tlistNEles
(
&
(
pVMA
->
nlist
))
>
1
)
{
SVArenaNode
*
pNode
=
tlistPopTail
(
&
(
pVMA
->
nlist
));
SVArenaNode
*
pNode
=
tlistTail
(
&
(
pVMA
->
nlist
));
tlistPop
(
&
(
pVMA
->
nlist
),
pNode
);
vArenaNodeFree
(
pNode
);
}
...
...
source/dnode/vnode/impl/src/vnodeBufferPool.c
浏览文件 @
04c83f49
...
...
@@ -61,14 +61,16 @@ void vnodeCloseBufPool(SVnode *pVnode) {
vmaDestroy
(
pVnode
->
pBufPool
->
inuse
);
while
(
true
)
{
SVMemAllocator
*
pVMA
=
tlist
Pop
Head
(
&
(
pVnode
->
pBufPool
->
incycle
));
SVMemAllocator
*
pVMA
=
tlistHead
(
&
(
pVnode
->
pBufPool
->
incycle
));
if
(
pVMA
==
NULL
)
break
;
tlistPop
(
&
(
pVnode
->
pBufPool
->
incycle
),
pVMA
);
vmaDestroy
(
pVMA
);
}
while
(
true
)
{
SVMemAllocator
*
pVMA
=
tlist
Pop
Head
(
&
(
pVnode
->
pBufPool
->
free
));
SVMemAllocator
*
pVMA
=
tlistHead
(
&
(
pVnode
->
pBufPool
->
free
));
if
(
pVMA
==
NULL
)
break
;
tlistPop
(
&
(
pVnode
->
pBufPool
->
free
),
pVMA
);
vmaDestroy
(
pVMA
);
}
...
...
@@ -83,8 +85,9 @@ void *vnodeMalloc(SVnode *pVnode, uint64_t size) {
if
(
pBufPool
->
inuse
==
NULL
)
{
while
(
true
)
{
// TODO: add sem_wait and sem_post
pBufPool
->
inuse
=
tlist
Pop
Head
(
&
(
pBufPool
->
free
));
pBufPool
->
inuse
=
tlistHead
(
&
(
pBufPool
->
free
));
if
(
pBufPool
->
inuse
)
{
tlistPop
(
&
(
pBufPool
->
free
),
pBufPool
->
inuse
);
break
;
}
}
...
...
source/dnode/vnode/impl/test/vnodeApiTests.cpp
浏览文件 @
04c83f49
...
...
@@ -131,7 +131,7 @@ TEST(vnodeApiTest, vnodeOpen_vnodeClose_test) {
{
// Create some child tables
int
ntables
=
1000
000
;
int
ntables
=
1000
;
int
batch
=
10
;
for
(
int
i
=
0
;
i
<
ntables
/
batch
;
i
++
)
{
SArray
*
pMsgs
=
(
SArray
*
)
taosArrayInit
(
batch
,
sizeof
(
SRpcMsg
*
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录