Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\swapfile.c Create Date:2022-07-28 15:18:45
Last Modify:2020-03-17 22:19:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name: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.

Proto:int add_swap_extent(struct swap_info_struct *sis, unsigned long start_page, unsigned long nr_pages, sector_t start_block)

Type:int

Parameter:

TypeParameterName
struct swap_info_struct *sis
unsigned longstart_page
unsigned longnr_pages
sector_tstart_block
2314  struct rb_node * * link = & rb_node, * parent = NULL
2322  When link cycle
2323  parent = link
2324  link = rb_right
2327  If parent Then
2328  se = rb_entry(parent, structswap_extent, rb_node)
2329  BUG_ON(start_page + nr_pages != start_page)
2330  If start_block + nr_pages == start_block Then
2332  nr_pages += nr_pages
2333  Return 0
2338  new_se = kmalloc( size of se , GFP_KERNEL)
2339  If (new_se == NULL) Then Return -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  Return 1
Caller
NameDescribe
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