函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:lkg_alloc - allocate a blkg*@blkcg: block cgroup the new blkg is associated with*@q: request_queue the new blkg is associated with*@gfp_mask: allocation mask to use* Allocate a new blkg assocating @blkcg and @q.

函数原型:static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q, gfp_t gfp_mask)

返回类型:struct blkcg_gq

参数:

类型参数名称
struct blkcg *blkcg
struct request_queue *q
gfp_tgfp_mask
151  blkg等于根据内存节点分配内存
152  如果非blkg则返回:NULL
155  如果percpu_ref_init - initialize a percpu refcount*@ref: percpu_ref to initialize*@release: function which will be called when refcount hits 0*@flags: PERCPU_REF_INIT_* flags*@gfp: allocation mask to use* Initializes @ref则转到:err_free
158  iostat_cpu等于alloc_percpu_gfp(structblkg_iostat_set, gfp_mask)
159  如果非iostat_cpu则转到:err_free
162  Pointer to the associated request_queue 等于q
163  初始化链表头
164  spin_lock_init( & async_bio_lock)
165  bio_list_init( & async_bios)
166  INIT_WORK( & async_bio_work, blkg_async_bio_workfn)
167  blkcg等于blkcg
169  u64_stats_init( & sync)
170  遍历可用CPU(cpu)
171  u64_stats_init( & sync)
173 i小于Maximum number of blkcg policies allowed to be registered concurrently.* Defined here to simplify include dependency.循环
174  pol等于blkcg_policy[i]
177  如果非blkcg_policy_enabled(q, pol)则继续下一循环
181  pd等于pd_alloc_fn(gfp_mask, q, blkcg)
182  如果非pd则转到:err_free
185  pd[i]等于pd
186  he blkg and policy id this per-policy data belongs to 等于blkg
187  plid等于i
190  返回:blkg
192  err_free :
193  lkg_free - free a blkg*@blkg: blkg to free* Free @blkg which may be partially allocated.
194  返回:NULL
调用者
名称描述
blkg_createIf @new_blkg is %NULL, this function tries to allocate a new one as* necessary using %GFP_NOWAIT. @new_blkg is always consumed on return.
blkg_conf_preplkg_conf_prep - parse and prepare for per-blkg config update*@blkcg: target block cgroup*@pol: target policy*@input: input string*@ctx: blkg_conf_ctx to be filled* Parse per-blkg config update from @input and initialize @ctx with the* result
blkcg_init_queuelkcg_init_queue - initialize blkcg part of request queue*@q: request_queue to initialize* Called from blk_alloc_queue_node(). Responsible for initializing blkcg* part of new request_queue @q.* RETURNS:* 0 on success, -errno on failure.