Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\xarray.c Create Date:2022-07-28 06:13:24
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

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

Proto:static int xas_expand(struct xa_state *xas, void *head)

Type:int

Parameter:

TypeParameterName
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  If Not head Then
563  If max == 0 Then Return 0
565  When max >> shift >= XA_CHUNK_SIZE cycle
566  shift += The xarray is constructed out of a set of 'chunks' of pointers
567  Return shift + The xarray is constructed out of a set of 'chunks' of pointers
568  Else if Private Then
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  When max > The maximum index that can be contained in the array without expanding it cycle
575  mark = 0
577  XA_NODE_BUG_ON(node, shift > BITS_PER_LONG)
578  node = xas_alloc(xas, shift)
579  If Not node Then Return -ENOMEM
582  Total entry count = 1
583  If 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. Then 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  cycle
589  If xa_track_free(xa) && mark == XA_FREE_MARK Then
598  If mark == XA_MARK_MAX Then Break
600  mark_inc(mark)
607  If Private Then
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  Return shift
Caller
NameDescribe
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()