Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\file.c Create Date:2022-07-28 20:08:31
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

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

Proto:static int expand_fdtable(struct files_struct *files, unsigned int nr)__releases(files->file_lock) __acquires(files->file_lock)

Type:int

Parameter:

TypeParameterName
struct files_struct *files
unsigned intnr
154  spin_unlock( & written part on a separate cache line in SMP)
155  new_fdt = alloc_fdtable(nr)
160  If atomic_read( & ad mostly part) > 1 Then synchronize_rcu - wait until a grace period has elapsed
163  spin_lock( & written part on a separate cache line in SMP)
164  If Not new_fdt Then Return -ENOMEM
170  If Value for the false possibility is greater at compile time(max_fds <= nr) Then
171  __free_fdtable(new_fdt)
172  Return -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  If cur_fdt != fdtab Then Post 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  Return 1
Caller
NameDescribe
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