函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\readahead.c Create Date:2022-07-27 15:35:41
Last Modify:2020-03-17 21:13:07 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:__do_page_cache_readahead() actually reads a chunk of disk. It allocates* the pages first, then submits them for I/O. This avoids the very bad* behaviour which would occur if page allocations are causing VM writeback.

函数原型:unsigned int __do_page_cache_readahead(struct address_space *mapping, struct file *filp, unsigned long offset, unsigned long nr_to_read, unsigned long lookahead_size)

返回类型:unsigned int

参数:

类型参数名称
struct address_space *mapping
struct file *filp
unsigned longoffset
unsigned longnr_to_read
unsigned longlookahead_size
159  inode等于host
162  LIST_HEAD(page_pool)
164  nr_pages等于0
165  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
166  gfp_mask等于readahead_gfp_mask(mapping)
168  如果isize恒等于0则转到:out
171  end_index等于isize减1右移PAGE_SHIFT determines the page size
176 page_idx小于nr_to_read循环
177  page_offset等于offsetpage_idx
179  如果page_offset大于end_index退出
182  page等于xa_load() - Load an entry from an XArray.*@xa: XArray.*@index: index into array.* Context: Any context. Takes and releases the RCU lock.* Return: The entry at @index in @xa.
192  nr_pages等于0
193  继续下一循环
196  page等于__page_cache_alloc(gfp_mask)
197  如果非page退出
199  Our offset within mapping. 等于page_offset
200  添加链表项
201  如果page_idx恒等于nr_to_readlookahead_sizeSetPageReadahead(page)
203  nr_pages自加
211  如果nr_pagesread_pages(mapping, filp, & page_pool, nr_pages, gfp_mask)
213  BUG_ON(!链表为空)
214  out :
215  返回:nr_pages
调用者
名称描述
force_page_cache_readaheadChunk the readahead into 2 megabyte units, so that we don't pin too much* memory at once.
ondemand_readaheadA minimal readahead algorithm for trivial sequential/random reads.
ra_submitSubmit IO for the read-ahead request in file_ra_state.