函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Returns an element of siblings' list.* We are looking for <count>th positive after <p>; if* found, dentry is grabbed and returned to caller.* If no such element exists, NULL is returned.

函数原型:static struct dentry *scan_positives(struct dentry *cursor, struct list_head *p, loff_t count, struct dentry *last)

返回类型:struct dentry

参数:

类型参数名称
struct dentry *cursor
struct list_head *p
loff_tcount
struct dentry *last
103  struct dentry * dentry = parent directory , * found = NULL
105  加自旋锁
106 p等于链表后项不等于 our children 循环
107  d等于list_entry - get the struct for this entry*@ptr: the &struct list_head pointer.*@type: the type of the struct this is embedded in.*@member: the name of the list_head within the struct.(p, structdentry, d_child)
109  如果 protected by d_lock 按位与DCACHE_DENTRY_CURSOR则继续下一循环
111  如果simple_positive(d)且非count先自减则
113  如果simple_positive(d)则found等于得到锁引用
118  count等于1
120  如果need_resched()则
124  cond_resched()
125  加自旋锁
128  自旋锁解锁
129  dput - release a dentry*@dentry: dentry to release * Release a dentry. This will drop the usage count and if appropriate* call the dentry unlink method as well as removing it from the queues and* releasing its resources
130  返回:found
调用者
名称描述
dcache_dir_lseek
dcache_readdirDirectory is locked and all positive dentries in it are safe, since* for ramfs-type trees they can't go away without unlink() or rmdir(),* both impossible due to the lock on directory.