Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\blk-cgroup.c Create Date:2022-07-28 17:40:44
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name: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.

Proto:int blkcg_policy_register(struct blkcg_policy *pol)

Type:int

Parameter:

TypeParameterName
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  When i < Maximum number of blkcg policies allowed to be registered concurrently.* Defined here to simplify include dependency. cycle If Not blkcg_policy[i] Then
1387  Break
1388  If i >= Maximum number of blkcg policies allowed to be registered concurrently.* Defined here to simplify include dependency. Then
1389  pr_warn("blkcg_policy_register: BLKCG_MAX_POLS too small\n")
1390  Go to err_unlock
1394  If Not operations ^ Not cpd_free_fn || Not pd_alloc_fn ^ Not pd_free_fn Then Go to err_unlock
1399  plid = i
1400  blkcg_policy[plid] = pol
1403  If operations Then
1407  cpd = operations (GFP_KERNEL)
1408  If Not cpd Then Go to err_free_cpds
1411  cpd[plid] = cpd
1412  the blkcg and policy id this per-policy data belongs to = blkcg
1413  plid = plid
1414  If cpd_init_fn Then cpd_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  If cgroup files for the policy Then 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  If legacy_cftypes Then WARN_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  Return 0
1431  err_free_cpds :
1432  If cpd_free_fn Then
1434  If cpd[plid] Then
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  Return ret
Caller
NameDescribe
throtl_init
iolatency_init
ioc_init