函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\mbcache.c Create Date:2022-07-29 11:04:36
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:mb_cache_shrink

函数原型:static unsigned long mb_cache_shrink(struct mb_cache *cache, unsigned long nr_to_scan)

返回类型:unsigned long

参数:

类型参数名称
struct mb_cache *cache
unsigned longnr_to_scan
285  shrunk等于0
287  加自旋锁
288 nr_to_scan自减且非链表为空循环
289  entry等于list_first_entry - get the first element from a list*@ptr: the list head to take the element from.*@type: the type of the struct this is embedded in.*@member: the name of the list_head within the struct.* Note, that list is expected to be not empty.( & c_list, structmb_cache_entry, e_list)
291  如果e_referenced
292  e_referenced等于0
294  继续下一循环
296  删除链表项并重新初始化
297  Number of entries in cache 自减
302  自旋锁解锁
303  head等于mb_cache_entry_head(cache, Key in hash - stable during lifetime of the entry )
304  hlist_bl_lock(head)
307  atomic_dec( & e_refcnt)
309  hlist_bl_unlock(head)
310  如果mb_cache_entry_put(cache, entry)则shrunk自加
312  cond_resched()
313  加自旋锁
315  自旋锁解锁
317  返回:shrunk
调用者
名称描述
mb_cache_entry_createmb_cache_entry_create - create entry in cache*@cache - cache where the entry should be created*@mask - gfp mask with which the entry should be allocated*@key - key of the entry*@value - value of the entry*@reusable - is the entry reusable by others?
mb_cache_scan
mb_cache_shrink_worker