函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:generic_swapfile_activate

函数原型:int generic_swapfile_activate(struct swap_info_struct *sis, struct file *swap_file, sector_t *span)

返回类型:int

参数:

类型参数名称
struct swap_info_struct *sis
struct file *swap_file
sector_t *span
151  mapping等于f_mapping
152  inode等于host
158  lowest_block等于负1
159  highest_block等于0
160  nr_extents等于0
163  blkbits等于i_blkbits
164  blocks_per_page等于PAGE_SIZE右移blkbits
170  probe_block等于0
171  page_no等于0
172  last_block等于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 右移blkbits
173 probe_blockblocks_per_page小于等于last_blockpage_no小于xtent of the swap_map 循环
178  cond_resched()
180  first_block等于查找文件中的块号
181  如果first_block恒等于0则转到:bad_bmap
187  如果first_block按位与blocks_per_page减1则
188  probe_block自加
189  转到:reprobe
197  如果block恒等于0则转到:bad_bmap
199  如果block不等于first_blockblock_in_page
201  probe_block自加
202  转到:reprobe
206  first_block右移等于PAGE_SHIFT determines the page size blkbits
207  如果page_no
217  ret等于Add a block range (and the corresponding page range) into this swapdev's* extent tree.* This function rather assumes that it is called in ascending page order.
218  如果ret小于0则转到:out
220  nr_extents加等于ret
221  page_no自加
222  probe_block加等于blocks_per_page
223  reprobe :
224  继续下一循环
226  ret等于nr_extents
227  span等于1加highest_blocklowest_block
228  如果page_no恒等于0则page_no等于1
230  xtent of the swap_map 等于page_no
231  al of usable pages of swap 等于page_no减1
232  dex of last free in swap_map 等于page_no减1
233  out :
234  返回:ret
235  bad_bmap :
236  打印错误信息("swapon: swapfile has holes\n")
237  ret等于负EINVAL
238  转到:out
调用者
名称描述
setup_swap_extentsA `swap extent' is a simple thing which maps a contiguous range of pages* onto a contiguous range of disk blocks. An ordered list of swap extents* is built at swapon time and is then used at swap_writepage/swap_readpage