From 5a17541b7134a3dd2596131196990a763fa6d4fb Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 8 Nov 2021 15:10:42 +0800 Subject: [PATCH] more --- .../dnode/vnode/impl/inc/vnodeAllocatorPool.h | 8 +++-- source/dnode/vnode/impl/inc/vnodeDef.h | 1 + .../dnode/vnode/impl/inc/vnodeMemAllocator.h | 30 +++++++++++++++++++ .../dnode/vnode/impl/src/vnodeAllocatorPool.c | 2 +- .../dnode/vnode/impl/src/vnodeMemAllocator.c | 14 +++++++++ 5 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 source/dnode/vnode/impl/inc/vnodeMemAllocator.h create mode 100644 source/dnode/vnode/impl/src/vnodeMemAllocator.c diff --git a/source/dnode/vnode/impl/inc/vnodeAllocatorPool.h b/source/dnode/vnode/impl/inc/vnodeAllocatorPool.h index ece9122513..53fa927241 100644 --- a/source/dnode/vnode/impl/inc/vnodeAllocatorPool.h +++ b/source/dnode/vnode/impl/inc/vnodeAllocatorPool.h @@ -17,16 +17,20 @@ #define _TD_VNODE_ALLOCATOR_POOL_H_ #include "vnode.h" +#include "vnodeMemAllocator.h" #ifdef __cplusplus extern "C" { #endif typedef struct { + int nexta; + int enda; + SVMemAllocator allocators[3]; } SVAllocatorPool; -int vnodeOpenAllocatorPool(SVnode *pVnode); -void vnodeCloseAllocatorPool(SVnode *pVnode); +int vnodeOpenAllocatorPool(SVnode *pVnode); +void vnodeCloseAllocatorPool(SVnode *pVnode); #ifdef __cplusplus } diff --git a/source/dnode/vnode/impl/inc/vnodeDef.h b/source/dnode/vnode/impl/inc/vnodeDef.h index 649de7f5ff..012e6fc5d1 100644 --- a/source/dnode/vnode/impl/inc/vnodeDef.h +++ b/source/dnode/vnode/impl/inc/vnodeDef.h @@ -30,6 +30,7 @@ struct SVnode { SVnodeOptions options; SVState state; SVAllocatorPool pool; + SVMemAllocator* inuse; SMeta* pMeta; STsdb* pTsdb; STQ* pTq; diff --git a/source/dnode/vnode/impl/inc/vnodeMemAllocator.h b/source/dnode/vnode/impl/inc/vnodeMemAllocator.h new file mode 100644 index 0000000000..784c70dd68 --- /dev/null +++ b/source/dnode/vnode/impl/inc/vnodeMemAllocator.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef _TD_VNODE_MEM_ALLOCATOR_H_ +#define _TD_VNODE_MEM_ALLOCATOR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { +} SVMemAllocator; + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_VNODE_MEM_ALLOCATOR_H_*/ diff --git a/source/dnode/vnode/impl/src/vnodeAllocatorPool.c b/source/dnode/vnode/impl/src/vnodeAllocatorPool.c index 36f3e7face..82dad85add 100644 --- a/source/dnode/vnode/impl/src/vnodeAllocatorPool.c +++ b/source/dnode/vnode/impl/src/vnodeAllocatorPool.c @@ -21,5 +21,5 @@ int vnodeOpenAllocatorPool(SVnode *pVnode) { } void vnodeCloseAllocatorPool(SVnode *pVnode) { - // TODO + // TODO } \ No newline at end of file diff --git a/source/dnode/vnode/impl/src/vnodeMemAllocator.c b/source/dnode/vnode/impl/src/vnodeMemAllocator.c new file mode 100644 index 0000000000..6dea4a4e57 --- /dev/null +++ b/source/dnode/vnode/impl/src/vnodeMemAllocator.c @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ \ No newline at end of file -- GitLab