函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\btree.c Create Date:2022-07-27 07:50:39
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:btree_insert_level

函数原型:static int btree_insert_level(struct btree_head *head, struct btree_geo *geo, unsigned long *key, void *val, int level, gfp_t gfp)

返回类型:int

参数:

类型参数名称
struct btree_head *head
struct btree_geo *geo
unsigned long *key
void *val
intlevel
gfp_tgfp
455  BUG_ON(!val)
456  如果height小于level
457  err等于btree_grow(head, geo, gfp)
458  如果err则返回:err
462  retry :
463  node等于locate the correct leaf node in the btree
464  pos等于getpos(geo, node, key)
465  fill等于getfill(geo, node, pos)
467  BUG_ON(pos < fill && keycmp(geo, node, pos, key) == 0)
469  如果fill恒等于no_pairs
473  new等于btree_node_alloc(head, gfp)
474  如果非new则返回:负ENOMEM
476  err等于btree_insert_level(head, geo, bkey(geo, node, fill / 2 - 1), new, level + 1, gfp)
479  如果err
481  返回:err
483 i小于fill除2循环
484  setkey(geo, new, i, bkey(geo, node, i))
485  setval(geo, new, i, bval(geo, node, i))
486  setkey(geo, node, i, bkey(geo, node, i + fill / 2))
487  setval(geo, node, i, bval(geo, node, i + fill / 2))
488  clearpair(geo, node, i + fill / 2)
490  如果fill按位与1则
491  setkey(geo, node, i, bkey(geo, node, fill - 1))
492  setval(geo, node, i, bval(geo, node, fill - 1))
493  clearpair(geo, node, fill - 1)
495  转到:retry
497  BUG_ON(fill >= no_pairs)
500 i大于pos循环
501  setkey(geo, node, i, bkey(geo, node, i - 1))
502  setval(geo, node, i, bval(geo, node, i - 1))
504  setkey(geo, node, pos, key)
505  setval(geo, node, pos, val)
507  返回:0
调用者
名称描述
btree_insert_level
btree_insert