fast_mblock_malloc_trunk_notify_func prototype changed

fstore_storage_engine
YuQing 2023-05-14 20:06:27 +08:00
parent 5247caa71a
commit c00a159fd3
2 changed files with 11 additions and 5 deletions

View File

@ -589,8 +589,8 @@ static int fast_mblock_prealloc(struct fast_mblock_man *mblock)
mblock->info.element_total_count += alloc_count; mblock->info.element_total_count += alloc_count;
if (mblock->trunk_callbacks.notify_func != NULL) if (mblock->trunk_callbacks.notify_func != NULL)
{ {
mblock->trunk_callbacks.notify_func(trunk_size, mblock->trunk_callbacks.notify_func(fast_mblock_notify_type_alloc,
mblock->trunk_callbacks.args); pMallocNode, mblock->trunk_callbacks.args);
} }
return 0; return 0;
@ -606,8 +606,8 @@ static inline void fast_mblock_remove_trunk(struct fast_mblock_man *mblock,
if (mblock->trunk_callbacks.notify_func != NULL) if (mblock->trunk_callbacks.notify_func != NULL)
{ {
mblock->trunk_callbacks.notify_func(-1 * pMallocNode->trunk_size, mblock->trunk_callbacks.notify_func(fast_mblock_notify_type_reclaim,
mblock->trunk_callbacks.args); pMallocNode, mblock->trunk_callbacks.args);
} }
} }

View File

@ -39,6 +39,11 @@
#define FAST_MBLOCK_ORDER_BY_ELEMENT_SIZE 2 #define FAST_MBLOCK_ORDER_BY_ELEMENT_SIZE 2
#define FAST_MBLOCK_ORDER_BY_USED_RATIO 3 #define FAST_MBLOCK_ORDER_BY_USED_RATIO 3
enum fast_mblock_notify_type {
fast_mblock_notify_type_alloc,
fast_mblock_notify_type_reclaim,
};
/* free node chain */ /* free node chain */
struct fast_mblock_node struct fast_mblock_node
{ {
@ -77,7 +82,8 @@ typedef int (*fast_mblock_malloc_trunk_check_func)(
const int alloc_bytes, void *args); const int alloc_bytes, void *args);
typedef void (*fast_mblock_malloc_trunk_notify_func)( typedef void (*fast_mblock_malloc_trunk_notify_func)(
const int alloc_bytes, void *args); const enum fast_mblock_notify_type type,
const struct fast_mblock_malloc *node, void *args);
struct fast_mblock_info struct fast_mblock_info
{ {