函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Expand the file descriptor table.* This function will allocate a new fdtable and both fd array and fdset, of* the given size.* Return <0 error code on error; 1 on successful completion.

函数原型:static int expand_fdtable(struct files_struct *files, unsigned int nr)__releases(files->file_lock) __acquires(files->file_lock)

返回类型:int

参数:

类型参数名称
struct files_struct *files
unsigned intnr
154  自旋锁解锁
155  new_fdt等于alloc_fdtable(nr)
160  如果atomic_read( & ad mostly part)大于1则synchronize_rcu - wait until a grace period has elapsed
163  加自旋锁
164  如果非new_fdt则返回:负ENOMEM
170  如果此条件成立可能性小(为编译器优化)(max_fds <= nr)则
171  __free_fdtable(new_fdt)
172  返回:负EMFILE
174  cur_fdt等于files_fdtable(files)
175  BUG_ON(nr < max_fds)
176  Copy all file descriptors from the old table to the new, expanded table and* clear the extra space. Called with the files spinlock held for write.
177  cu_assign_pointer() - assign to RCU-protected pointer*@p: pointer to assign to*@v: value to assign (publish)* Assigns the specified value to the specified RCU-protected* pointer, ensuring that any concurrent RCU readers will see* any prior initialization(fdt, new_fdt)
178  如果cur_fdt不等于fdtabPost an RCU callback to be invoked after the end of an RCU grace* period. But since we have but one CPU, that would be after any* quiescent state.
181  smp_wmb()
182  返回:1
调用者
名称描述
expand_filesExpand files.* This function will expand the file structures, if the requested size exceeds* the current capacity and there is room for expansion.* Return <0 error code on error; 0 when nothing done; 1 when files were