函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:xas_expand adds nodes to the head of the tree until it has reached* sufficient height to be able to contain @xas->xa_index

函数原型:static int xas_expand(struct xa_state *xas, void *head)

返回类型:int

参数:

类型参数名称
struct xa_state *xas
void *head
557  xa等于xa
558  struct xa_node * node = NULL
559  shift等于0
560  max等于Use this to calculate the maximum index that will need to be created* in order to add the entry described by @xas. Because we cannot store a* multiple-index entry at index 0, the calculation is a little more complex* than you might expect.
562  如果非head
563  如果max恒等于0则返回:0
565 max右移shift位大于等于XA_CHUNK_SIZE循环
566  shift加等于The xarray is constructed out of a set of 'chunks' of pointers
567  返回:shiftThe xarray is constructed out of a set of 'chunks' of pointers
568  否则如果Private
569  node等于Private
570  shift等于Bits remaining in each slot The xarray is constructed out of a set of 'chunks' of pointers
572  xa_node = NULL
574 max大于The maximum index that can be contained in the array without expanding it 循环
575  mark等于0
577  XA_NODE_BUG_ON(node, shift > BITS_PER_LONG)
578  node等于xas_alloc(xas, shift)
579  如果非node则返回:负ENOMEM
582  Total entry count 等于1
583  如果xa_is_value() - Determine if an entry is a value.*@entry: XArray entry.* Context: Any context.* Return: True if the entry is a value, false if it is a pointer.Value entry count 等于1
585  RCU_INIT_POINTER() - initialize an RCU protected pointer*@p: The pointer to be initialized.*@v: The value to initialized the pointer to.* Initialize an RCU-protected pointer in special cases where readers(slots[0], head)
588  循环
589  如果xa_track_free(xa)且mark恒等于XA_FREE_MARK
598  如果mark恒等于XA_MARK_MAX退出
600  mark_inc(mark)
607  如果Private
608  Slot offset in parent 等于0
611  head等于Private
612  cu_assign_pointer() - assign to RCU-protected pointer*@p: pointer to assign to*@v: value to assign (publish)* Assigns the specified value to the specified RCU-protected* pointer, ensuring that any concurrent RCU readers will see* any prior initialization(xa_head, head)
613  xas_update(xas, node)
615  shift加等于The xarray is constructed out of a set of 'chunks' of pointers
618  xa_node等于node
619  返回:shift
调用者
名称描述
xas_createxas_create() - Create a slot to store an entry in.*@xas: XArray operation state.*@allow_root: %true if we can store the entry in the root directly* Most users will not need to call this function directly, as it is called* by xas_store()