函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:da_alloc_range() - Allocate an unused ID.*@ida: IDA handle.*@min: Lowest ID to allocate.*@max: Highest ID to allocate.*@gfp: Memory allocation flags.* Allocate an ID between @min and @max, inclusive. The allocated ID will

函数原型:int ida_alloc_range(struct ida *ida, unsigned int min, unsigned int max, gfp_t gfp)

返回类型:int

参数:

类型参数名称
struct ida *ida
unsigned intmin
unsigned intmax
gfp_tgfp
382  XA_STATE() - Declare an XArray operation state.*@name: Name of this operation state (usually xas).*@array: Array to operate on.*@index: Initial index of interest.* Declare and initialise an xa_state on the stack.(xas, & xa, min / IDA_BITMAP_BITS)
383  bit等于min取模IDA_BITMAP_BITS
385  struct ida_bitmap * bitmap, * alloc = NULL
387  如果min小于0则返回:负ENOSPC
390  如果max小于0则max等于INT_MAX
393  retry :
394  xas_lock_irqsave( & xas, flags)
395  :
396  bitmap等于xas_find_marked() - Find the next marked entry in the XArray.*@xas: XArray operation state.*@max: Highest index to return.*@mark: Mark number to search for.* If the @xas has not yet been walked to an entry, return the marked entry
397  如果xa_index大于minIDA_BITMAP_BITSbit等于0
399  如果xa_indexIDA_BITMAP_BITSbit大于max则转到:nospc
402  如果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.
403  tmp等于xa_to_value() - Get value stored in an XArray entry.*@entry: XArray entry.* Context: Any context.* Return: The value stored in the XArray entry.
407  如果xa_indexIDA_BITMAP_BITSbit大于max则转到:nospc
410  tmp或等于1UL左移bit
412  转到:out
415  bitmap等于alloc
416  如果非bitmapbitmap等于分配内存并置零
418  如果非bitmap则转到:alloc
420  bitmap[0]等于tmp
421  xas_store() - Store this entry in the XArray
423  bitmap[0]等于0
424  转到:out
428  如果bitmap
429  bit等于d_next_zero_bit - find the next cleared bit in a memory region*@addr: The address to base the search on*@offset: The bitnumber to start searching at*@size: The bitmap size in bits* Returns the bit number of the next zero bit
430  如果xa_indexIDA_BITMAP_BITSbit大于max则转到:nospc
432  如果bit恒等于IDA_BITMAP_BITS则转到:next
435  __set_bit - Set a bit in memory*@nr: the bit to set*@addr: the address to start counting from* Unlike set_bit(), this function is non-atomic. If it is called on the same* region of memory concurrently, the effect may be that only one operation* succeeds.
436  如果bitmap_full(bitmap, IDA_BITMAP_BITS)则xas_clear_mark() - Clears the mark on this entry and its parents.*@xas: XArray operation state.*@mark: Mark number.* Clears the specified mark on this entry, and walks back to the head* attempting to clear it on all the ancestor entries. Does nothing if
438  否则
441  否则
442  bitmap等于alloc
443  如果非bitmapbitmap等于分配内存并置零
445  如果非bitmap则转到:alloc
449  xas_store() - Store this entry in the XArray
451  out :
452  xas_unlock_irqrestore( & xas, flags)
453  如果xas_nomem() - Allocate memory if needed.*@xas: XArray operation state.*@gfp: Memory allocation flags.* If we need to add new nodes to the XArray, we try to allocate memory* with GFP_NOWAIT while holding the lock, which will usually succeed.
454  xa_index等于minIDA_BITMAP_BITS
455  bit等于min取模IDA_BITMAP_BITS
456  转到:retry
458  如果bitmap不等于alloc释放内存
460  如果xas_error() - Return an errno stored in the xa_state.*@xas: XArray operation state.* Return: 0 if no error has been noted. A negative errno if one has.则返回:xas_error() - Return an errno stored in the xa_state.*@xas: XArray operation state.* Return: 0 if no error has been noted. A negative errno if one has.
462  返回:xa_indexIDA_BITMAP_BITSbit
463  alloc :
464  xas_unlock_irqrestore( & xas, flags)
465  alloc等于分配内存并置零
466  如果非alloc则返回:负ENOMEM
468  xas_set() - Set up XArray operation state for a different index
469  bit等于min取模IDA_BITMAP_BITS
470  转到:retry
471  nospc :
472  xas_unlock_irqrestore( & xas, flags)
473  返回:负ENOSPC
调用者
名称描述
objagg_obj_root_id_alloc
ida_allocda_alloc() - Allocate an unused ID.*@ida: IDA handle.*@gfp: Memory allocation flags.* Allocate an ID between 0 and %INT_MAX, inclusive.* Context: Any context.* Return: The allocated ID, or %-ENOMEM if memory could not be allocated,
ida_alloc_minda_alloc_min() - Allocate an unused ID
ida_alloc_maxda_alloc_max() - Allocate an unused ID
get_anon_bdevget_anon_bdev - Allocate a block device for filesystems which don't have one.*@p: Pointer to a dev_t.* Filesystems which don't use real block devices can call this function* to allocate a virtual block device.* Context: Any context