Linux 内核态 内存B+树,支持key-value一对多,最大单key重复value可以设置,默认512.
/* ktls-bplus.c */
#include "ktls-bplus.h"
static void dump(struct node* node)
{
int i = 0;
printk("dump keys[%d][%d]:\n", node->used, node->level);
for (; i < node->used; i++) {
printk("[%d]%u:%p ", i, node->key[i], node->val[i]);
if (i % 6 == 0) {
printk("\n");
}
}
printk("\n");
}
struct node* bp_new_node()
{
struct node *n = NULL;
n = (struct node*)kzalloc(sizeof(struct node), GFP_ATOMIC);
if (n == NULL) {
printk("[%s]>>>>>>>>>>>>>>>>>>>