函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\swapfile.c Create Date:2022-07-27 16:49:10
Last Modify:2020-03-17 22:19:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称: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.

函数原型:int add_swap_extent(struct swap_info_struct *sis, unsigned long start_page, unsigned long nr_pages, sector_t start_block)

返回类型:int

参数:

类型参数名称
struct swap_info_struct *sis
unsigned longstart_page
unsigned longnr_pages
sector_tstart_block
2314  struct rb_node * * link = & rb_node, * parent = NULL
2322 link循环
2323  parent等于link
2324  link等于rb_right
2327  如果parent
2328  se等于rb_entry(parent, structswap_extent, rb_node)
2329  BUG_ON(start_page + nr_pages != start_page)
2330  如果start_blocknr_pages恒等于start_block
2332  nr_pages加等于nr_pages
2333  返回:0
2338  new_se等于kmalloc(se的长度, GFP_KERNEL)
2339  如果(new_se == NULL)则返回:负ENOMEM
2341  start_page等于start_page
2342  nr_pages等于nr_pages
2343  start_block等于start_block
2345  rb_link_node( & rb_node, parent, link)
2346  rb_insert_color( & rb_node, & of the swap extent rbtree )
2347  返回:1
调用者
名称描述
generic_swapfile_activate
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
iomap_swapfile_add_extentCollect physical extents for this swap file. Physical extents reported to* the swap code must be trimmed to align to a page boundary. The logical* offset within the file is irrelevant since the swapfile code maps logical