函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:generic_file_buffered_read - generic file read routine*@iocb: the iocb to read*@iter: data destination*@written: already copied* This is a generic file read routine, and uses the* mapping->a_ops->readpage() function for the actual low-level stuff.

函数原型:static ssize_t generic_file_buffered_read(struct kiocb *iocb, struct iov_iter *iter, ssize_t written)

返回类型:ssize_t

参数:

类型参数名称
struct kiocb *iocb
struct iov_iter *iter
ssize_twritten
2012  filp等于文件指针
2013  mapping等于f_mapping
2014  inode等于host
2015  ra等于f_ra
2016  ppos等于文件偏移
2022  error等于0
2024  如果此条件成立可能性小(为编译器优化)( * ppos >= s_maxbytes)则返回:0
2026  Cap the iov_iter by given limit; note that the second argument is* *not* the new size - it's upper limit for such. Passing it a value* greater than the amount of data in iov_iter is fine - it'll just do* nothing in that case.
2028  index等于ppos右移PAGE_SHIFT determines the page size
2029  prev_index等于Cache last read() position 右移PAGE_SHIFT determines the page size
2030  prev_offset等于Cache last read() position 按位与PAGE_SIZE减1
2031  last_index等于pposcountPAGE_SIZE减1右移PAGE_SHIFT determines the page size
2032  offset等于ppos按位与PAGE_MASK的反
2034  循环
2040  cond_resched()
2041  find_page :
2043  error等于负EINTR
2044  转到:out
2047  page等于d_get_page - find and get a page reference*@mapping: the address_space to search*@offset: the page index* Looks up the page cache slot at @mapping & @offset. If there is a* page cache page, it is returned with an increased refcount.
2048  如果非page
2049  如果ki_flags按位与IOCB_NOWAIT则转到:would_block
2058  如果PageReadahead(page)则
2063  如果非PageUptodate(page)则
2064  如果ki_flags按位与IOCB_NOWAIT
2065  put_page(page)
2066  转到:would_block
2077  如果PageUptodate(page)则转到:page_ok
2096  page_ok :
2106  isize等于NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they
2107  end_index等于isize减1右移PAGE_SHIFT determines the page size
2109  put_page(page)
2110  转到:out
2114  nr等于PAGE_SIZE
2115  如果index恒等于end_index
2116  nr等于isize减1按位与PAGE_MASK的反的值加1
2117  如果nr小于等于offset
2118  put_page(page)
2119  转到:out
2122  nr等于nroffset
2128  如果Might pages of this file have been modified in userspace?* Note that i_mmap_writable counts all VM_SHARED vmas: do_mmap_pgoff* marks vma as VM_SHARED if it is shared, and the file was opened for* writing iflush_dcache_page(page)
2135  如果prev_index不等于indexoffset不等于prev_offsetmark_page_accessed(page)
2137  prev_index等于index
2144  ret等于copy_page_to_iter(page, offset, nr, iter)
2145  offset加等于ret
2146  index加等于offset右移PAGE_SHIFT determines the page size
2147  offset与等于PAGE_MASK的反
2148  prev_offset等于offset
2150  put_page(page)
2151  written加等于ret
2152  如果非iov_iter_count(iter)则转到:out
2154  如果ret小于nr
2155  error等于负EFAULT
2156  转到:out
2158  继续下一循环
2160  page_not_up_to_date :
2162  error等于lock_page_killable is like lock_page but can be interrupted by fatal* signals. It returns 0 if it locked the page and -EINTR if it was* killed while waiting.
2163  如果此条件成立可能性小(为编译器优化)(error)则转到:readpage_error
2166  page_not_up_to_date_locked :
2170  put_page(page)
2171  继续下一循环
2175  如果PageUptodate(page)则
2177  转到:page_ok
2180  readpage :
2186  ClearPageError(page)
2188  error等于readpage(filp, page)
2191  如果error恒等于AOP_TRUNCATED_PAGE
2192  put_page(page)
2193  error等于0
2194  转到:find_page
2196  转到:readpage_error
2199  如果非PageUptodate(page)则
2203  如果非PageUptodate(page)则
2220  转到:page_ok
2222  readpage_error :
2224  put_page(page)
2225  转到:out
2227  no_cached_page :
2232  page等于page_cache_alloc(mapping)
2233  如果非page
2234  error等于负ENOMEM
2235  转到:out
2237  error等于add_to_page_cache_lru(page, mapping, index, Restricts the given gfp_mask to what the mapping allows. )
2239  如果error
2240  put_page(page)
2241  如果error恒等于负EEXIST
2242  error等于0
2243  转到:find_page
2245  转到:out
2247  转到:readpage
2250  would_block :
2251  error等于负EAGAIN
2252  out :
2253  Cache last read() position 等于prev_index
2254  Cache last read() position 左移等于PAGE_SHIFT determines the page size
2255  Cache last read() position 或等于prev_offset
2257  ppos等于index左移PAGE_SHIFT determines the page size 位的值加offset
2258  file_accessed(filp)
2259  返回:如果writtenwritten否则error
调用者
名称描述
generic_file_read_itergeneric_file_read_iter - generic filesystem read routine*@iocb: kernel I/O control block*@iter: destination for the data read* This is the "read_iter()" routine for all filesystems* that can use the page cache directly