函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:__lc_get

函数原型:static struct lc_element *__lc_get(struct lru_cache *lc, unsigned int enr, unsigned int flags)

返回类型:struct lc_element

参数:

类型参数名称
struct lru_cache *lc
unsigned intenr
unsigned intflags
365  his is developers aid only.* it catches concurrent access (lack of locking on the users part) ()
366  如果 see below: flag-bits for lru_cache 按位与LC_STARVING
367  starving先自加
368  RETURN(NULL)
371  e等于__lc_find(lc, enr, 1)
376  如果e
382  如果非flags按位与LC_GET_MAY_USE_UNCOMMITTED的值则RETURN(NULL)
386  refcnt先自加
387  hits先自加
388  RETURN(e)
391  hits先自加
392  如果refcnt自加恒等于0则 number of elements currently on in_use list 自加
394  链表项移动到头部
395  RETURN(e)
399  misses先自加
400  如果非flags按位与LC_GET_MAY_CHANGE的值则RETURN(NULL)
405  st_and_set_bit - Set a bit and return its old value*@nr: Bit to set*@addr: Address to count from* This is an atomic fully-ordered operation (implied full memory barrier).
410  如果st_bit - Determine whether a bit is set*@nr: bit number to test*@addr: Address to start counting from
411  locked先自加
412  RETURN(NULL)
418  如果非lc_unused_element_available(lc)则
419  __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.
420  RETURN(NULL)
426  如果 number of elements currently on to_be_changed list 大于等于 allow to accumulate a few (index:label) changes, * but no more than max_pending_changes RETURN(NULL)
429  e等于lc_prepare_for_change(lc, enr)
430  BUG_ON(!e)
432  lear_bit - Clears a bit in memory*@nr: Bit to clear*@addr: Address to start counting from* This is a relaxed atomic operation (no implied memory barriers).
433  BUG_ON(++refcnt != 1)
434  number of elements currently on in_use list 自加
435  number of elements currently on to_be_changed list 自加
437  RETURN(e)
调用者
名称描述
lc_getlc_get - get element by label, maybe change the active set*@lc: the lru cache to operate on*@enr: the label to look up* Finds an element in the cache, increases its usage count,* "touches" and returns it
lc_get_cumulativelc_get_cumulative - like lc_get; also finds to-be-changed elements*@lc: the lru cache to operate on*@enr: the label to look up* Unlike lc_get this also returns the element for @enr, if it is belonging to* a pending transaction, so the return values are
lc_try_getlc_try_get - get element by label, if present; do not change the active set*@lc: the lru cache to operate on*@enr: the label to look up* Finds an element in the cache, increases its usage count,* "touches" and returns it