函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:This is the worker routine which does all the work of mapping the disk* blocks and constructs largest possible bios, submits them for IO if the* blocks are not contiguous on the disk

函数原型:static struct bio *do_mpage_readpage(struct mpage_readpage_args *args)

返回类型:struct bio

参数:

类型参数名称
struct mpage_readpage_args *args
158  page等于page
159  inode等于host
160  blkbits等于i_blkbits
161  blocks_per_page等于PAGE_SIZE右移blkbits
162  blocksize等于1左移blkbits
163  map_bh等于map_bh
169  first_hole等于blocks_per_page
170  struct block_device * bdev = NULL
172  fully_mapped等于1
178  如果is_readahead
179  op_flags等于REQ_RAHEAD
180  gfp等于readahead_gfp_mask( See page-flags.h for PAGE_MAPPING_FLAGS )
181  否则
182  op_flags等于0
183  gfp等于Restricts the given gfp_mask to what the mapping allows.
186  如果page_has_buffers(page)则转到:confused
189  block_in_file等于 Our offset within mapping. 左移PAGE_SHIFT determines the page size blkbits
190  last_block等于block_in_filenr_pagesblocks_per_page
191  last_block_in_file等于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 blocksize减1右移blkbits
192  如果last_block大于last_block_in_filelast_block等于last_block_in_file
194  page_block等于0
199  nblocks等于 size of mapping 右移blkbits
200  如果buffer_mapped(map_bh)且block_in_file大于first_logical_blockblock_in_file小于first_logical_blocknblocks
203  map_offset等于block_in_filefirst_logical_block
204  last等于nblocksmap_offset
206  循环
207  如果relative_block恒等于last
211  如果page_block恒等于blocks_per_page退出
215  page_block自加
216  block_in_file自加
218  bdev等于b_bdev
224  the page this bh is mapped to 等于page
225 page_block小于blocks_per_page循环
226  buffer state bitmap (see above) 等于0
227  size of mapping 等于0
229  如果block_in_file小于last_block
231  如果get_block(inode, block_in_file, map_bh, 0)则转到:confused
236  如果非buffer_mapped(map_bh)则
237  fully_mapped等于0
238  如果first_hole恒等于blocks_per_pagefirst_hole等于page_block
240  page_block自加
241  block_in_file自加
242  继续下一循环
253  转到:confused
256  如果first_hole不等于blocks_per_page则转到:confused
260  如果page_blockblocks[page_block - 1]不等于 start block number 减1则转到:confused
262  nblocks等于 size of mapping 右移blkbits
263  循环
264  如果relative_block恒等于nblocks
267  否则如果page_block恒等于blocks_per_page退出
270  page_block自加
271  block_in_file自加
273  bdev等于b_bdev
276  如果first_hole不等于blocks_per_page
277  zero_user_segment(page, first_hole << blkbits, PAGE_SIZE)
278  如果first_hole恒等于0则
281  转到:out
283  否则如果fully_mapped
284  SetPageMappedToDisk(page)
287  如果fully_mappedblocks_per_page恒等于1且非PageUptodate(page)且cleancache_get_page(page)恒等于0则
289  SetPageUptodate(page)
290  转到:confused
296  如果biolast_block_in_bio不等于blocks[0]减1则bio等于mpage_bio_submit(REQ_OP_READ, op_flags, bio)
299  alloc_new :
300  如果(bio == NULL)则
301  如果first_hole恒等于blocks_per_page
306  bio等于mpage_alloc(bdev, blocks[0] << (blkbits - 9), min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(int, nr_pages, BIO_MAX_PAGES), gfp)
310  如果(bio == NULL)则转到:confused
314  length等于first_hole左移blkbits
315  如果bio_add_page(bio, page, length, 0)小于length
316  bio等于mpage_bio_submit(REQ_OP_READ, op_flags, bio)
317  转到:alloc_new
320  relative_block等于block_in_filefirst_logical_block
321  nblocks等于 size of mapping 右移blkbits
322  如果buffer_boundary(map_bh)且relative_block恒等于nblocksfirst_hole不等于blocks_per_pagebio等于mpage_bio_submit(REQ_OP_READ, op_flags, bio)
325  否则last_block_in_bio等于blocks[blocks_per_page - 1]
327  out :
328  返回:bio
330  confused :
331  如果biobio等于mpage_bio_submit(REQ_OP_READ, op_flags, bio)
333  如果非PageUptodate(page)则Generic "read page" function for block devices that have the normal* get_block functionality
335  否则lock_page - unlock a locked page*@page: the page* Unlocks the page and wakes up sleepers in ___wait_on_page_locked().* Also wakes sleepers in wait_on_page_writeback() because the wakeup* mechanism between PageLocked pages and PageWriteback pages is shared.
337  转到:out
调用者
名称描述
mpage_readpagesmpage_readpages - populate an address space with some pages & start reads against them*@mapping: the address_space*@pages: The address of a list_head which contains the target pages. These
mpage_readpageThis isn't called much at all