Function report |
Source Code:mm\page_io.c |
Create Date:2022-07-28 15:13:38 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:generic_swapfile_activate
Proto:int generic_swapfile_activate(struct swap_info_struct *sis, struct file *swap_file, sector_t *span)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct swap_info_struct * | sis | |
| struct file * | swap_file | |
| sector_t * | span |
| 158 | lowest_block = -1 |
| 159 | highest_block = 0 |
| 160 | nr_extents = 0 |
| 164 | blocks_per_page = PAGE_SIZE >> blkbits |
| 170 | probe_block = 0 |
| 171 | page_no = 0 |
| 173 | When probe_block + blocks_per_page <= last_block && page_no < xtent of the swap_map cycle |
| 178 | cond_resched() |
| 181 | If first_block == 0 Then Go to bad_bmap |
| 187 | If first_block & blocks_per_page - 1 Then |
| 188 | probe_block++ |
| 189 | Go to reprobe |
| 192 | When block_in_page < blocks_per_page cycle |
| 199 | If block != first_block + block_in_page Then |
| 201 | probe_block++ |
| 202 | Go to reprobe |
| 207 | If page_no Then |
| 208 | If first_block < lowest_block Then lowest_block = first_block |
| 210 | If first_block > highest_block Then highest_block = first_block |
| 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. |
| 220 | nr_extents += ret |
| 221 | page_no++ |
| 222 | probe_block += blocks_per_page |
| 223 | reprobe : |
| 224 | Continue |
| 226 | ret = nr_extents |
| 227 | span = 1 + highest_block - lowest_block |
| 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 | Return ret |
| 235 | bad_bmap : |
| 236 | pr_err("swapon: swapfile has holes\n") |
| 238 | Go to out |
| Name | Describe |
|---|---|
| setup_swap_extents | A `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 |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |