函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:lkcg_policy_register - register a blkcg policy*@pol: blkcg policy to register* Register @pol with blkcg core. Might sleep and @pol may be modified on* successful registration. Returns 0 on success and -errno on failure.

函数原型:int blkcg_policy_register(struct blkcg_policy *pol)

返回类型:int

参数:

类型参数名称
struct blkcg_policy *pol
1380  mutex_lock( & lkcg_pol_mutex protects blkcg_policy[] and policy [de]activation.* blkcg_pol_register_mutex nests outside of it and synchronizes entire* policy [un]register operations including cgroup file additions /* removals)
1381  mutex_lock( & blkcg_pol_mutex)
1384  ret等于负ENOSPC
1385 i小于Maximum number of blkcg policies allowed to be registered concurrently.* Defined here to simplify include dependency.循环如果非blkcg_policy[i]则
1387  退出
1388  如果i大于等于Maximum number of blkcg policies allowed to be registered concurrently.* Defined here to simplify include dependency.
1389  打印警告信息("blkcg_policy_register: BLKCG_MAX_POLS too small\n")
1390  转到:err_unlock
1394  如果非 operations 按位异或非cpd_free_fn或非pd_alloc_fn按位异或非pd_free_fn则转到:err_unlock
1399  plid等于i
1400  blkcg_policy[plid] = pol
1403  如果 operations
1407  cpd等于 operations (GFP_KERNEL)
1408  如果非cpd则转到:err_free_cpds
1411  cpd[plid]等于cpd
1412  the blkcg and policy id this per-policy data belongs to 等于blkcg
1413  plid等于plid
1414  如果cpd_init_fncpd_init_fn(cpd)
1419  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
1422  如果 cgroup files for the policy WARN_ON(group_add_dfl_cftypes - add an array of cftypes for default hierarchy*@ss: target cgroup subsystem*@cfts: zero-length name terminated array of cftypes* Similar to cgroup_add_cftypes() but the added files are only used for* the default hierarchy.)
1425  如果legacy_cftypesWARN_ON(group_add_legacy_cftypes - add an array of cftypes for legacy hierarchies*@ss: target cgroup subsystem*@cfts: zero-length name terminated array of cftypes* Similar to cgroup_add_cftypes() but the added files are only used for* the legacy hierarchies.)
1428  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
1429  返回:0
1431  err_free_cpds :
1432  如果cpd_free_fn
1434  如果cpd[plid]则
1435  cpd_free_fn(cpd[plid])
1436  cpd[plid] = NULL
1440  =
1441  err_unlock :
1442  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
1443  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
1444  返回:ret
调用者
名称描述
throtl_init
iolatency_init
ioc_init