Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:swapon tell device that all the old swap contents can be discarded,* to allow the swap device to optimize its wear-levelling.

Proto:static int discard_swap(struct swap_info_struct *si)

Type:int

Parameter:

TypeParameterName
struct swap_info_struct *si
176  err = 0
179  se = first_se(si)
180  start_block = start_block + 1 << PAGE_SHIFT determines the page size - 9
181  nr_blocks = nr_pages - 1 << PAGE_SHIFT determines the page size - 9
182  If nr_blocks Then
183  err = blkdev_issue_discard(swap device or bdev of swap file , start_block, nr_blocks, GFP_KERNEL, 0)
185  If err Then Return err
187  cond_resched()
190  When se cycle
191  start_block = start_block << PAGE_SHIFT determines the page size - 9
192  nr_blocks = nr_pages << PAGE_SHIFT determines the page size - 9
194  err = blkdev_issue_discard(swap device or bdev of swap file , start_block, nr_blocks, GFP_KERNEL, 0)
196  If err Then Break
199  cond_resched()
201  Return err
Caller
NameDescribe
SYSCALL_DEFINE2