函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:If @new_blkg is %NULL, this function tries to allocate a new one as* necessary using %GFP_NOWAIT. @new_blkg is always consumed on return.

函数原型:static struct blkcg_gq *blkg_create(struct blkcg *blkcg, struct request_queue *q, struct blkcg_gq *new_blkg)

返回类型:struct blkcg_gq

参数:

类型参数名称
struct blkcg *blkcg
struct request_queue *q
struct blkcg_gq *new_blkg
233  WARN_ON_ONCE(!_read_lock_held() - might we be in RCU read-side critical section?* If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an RCU* read-side critical section)
234  lockdep_assert_held( & queue_lock)
237  如果blk_queue_dying(q)则
238  ret等于负ENODEV
239  转到:err_free_blkg
243  如果非ss_tryget_online - try to obtain a reference on the specified css if online*@css: target css* Obtain a reference on @css if it's online
244  ret等于负ENODEV
245  转到:err_free_blkg
248  wb_congested等于wb_congested_get_create(backing_dev_info, PI: Subsys-unique ID. 0 is unused and root is always 1. The* matching css can be looked up using css_from_id()., GFP_NOWAIT | DOC: Action modifiers* Action modifiers* ~~~~~~~~~~~~~~~~* %__GFP_NOWARN suppresses allocation failure reports.* %__GFP_COMP address compound page metadata.* %__GFP_ZERO returns a zeroed page on success.)
251  如果非wb_congested
252  ret等于负ENOMEM
253  转到:err_put_css
257  如果非new_blkg
258  new_blkg等于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.
260  ret等于负ENOMEM
261  转到:err_put_congested
264  blkg等于new_blkg
265  * Each blkg gets congested separately and the congestion state is * propagated to the matching bdi_writeback_congested.等于wb_congested
268  如果lkcg_parent - get the parent of a blkcg*@blkcg: blkcg of interest* Return the parent blkcg of @blkcg. Can be called anytime.
269  all non-root blkcg_gq's are guaranteed to have access to parent 等于__blkg_lookup - internal version of blkg_lookup()*@blkcg: blkcg of interest*@q: request_queue of interest*@update_hint: whether to update lookup hint with the result or not* This is internal version and shouldn't be used by policy* implementations
271  ret等于负ENODEV
272  转到:err_put_congested
274  lkg_get - get a blkg reference*@blkg: blkg to get* The caller should be holding an existing reference.
278 i小于Maximum number of blkcg policies allowed to be registered concurrently.* Defined here to simplify include dependency.循环
279  pol等于blkcg_policy[i]
281  如果pd[i]且pd_init_fnpd_init_fn(pd[i])
286  加自旋锁
287  ret等于在radix树中插入节点
288  如果此条件成立可能性大(为编译器优化)(!ret)则
289  添加哈希记录
290  添加链表项
293  pol等于blkcg_policy[i]
295  如果pd[i]且pd_online_fnpd_online_fn(pd[i])
299  is this blkg online? protected by both blkcg and q locks = true
300  自旋锁解锁
302  如果非ret则返回:blkg
306  lkg_put - put a blkg reference*@blkg: blkg to put
307  返回:错误号
309  err_put_congested :
310  wb_congested_put(wb_congested)
311  err_put_css :
312  设置一个css引用
313  err_free_blkg :
314  lkg_free - free a blkg*@blkg: blkg to free* Free @blkg which may be partially allocated.
315  返回:错误号
调用者
名称描述
__blkg_lookup_create__blkg_lookup_create - lookup blkg, try to create one if not there*@blkcg: blkcg of interest*@q: request_queue of interest* Lookup blkg for the @blkcg - @q pair. If it doesn't exist, try to* create one
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.