| Function report | 
| Source Code: mm\swapfile.c | Create Date:2022-07-28 15:16:24 | 
| Last Modify:2020-03-17 22:19:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:swap allocation tell device that a cluster of swap can now be discarded,* to allow the swap device to optimize its wear-levelling.
Proto:static void discard_swap_cluster(struct swap_info_struct *si, unsigned long start_page, unsigned long nr_pages)
Type:void
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| struct swap_info_struct * | si | |
| unsigned long | start_page | |
| unsigned long | nr_pages | 
| 231 | se = offset_to_swap_extent(si, start_page) | 
| 234 | offset = start_page - start_page | 
| 235 | start_block = start_block + offset | 
| 240 | start_page += nr_blocks | 
| 243 | start_block <<= PAGE_SHIFT determines the page size - 9 | 
| 244 | nr_blocks <<= PAGE_SHIFT determines the page size - 9 | 
| 245 | If blkdev_issue_discard(swap device or bdev of swap file , start_block, nr_blocks, GFP_NOIO, 0) Then Break | 
| Name | Describe | 
|---|---|
| swap_do_scheduled_discard | Doing discard actually. After a cluster discard is finished, the cluster* will be added to free cluster list. caller should hold si->lock. | 
| 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 |