函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:swap allocation tell device that a cluster of swap can now be discarded,* to allow the swap device to optimize its wear-levelling.

函数原型:static void discard_swap_cluster(struct swap_info_struct *si, unsigned long start_page, unsigned long nr_pages)

返回类型:void

参数:

类型参数名称
struct swap_info_struct *si
unsigned longstart_page
unsigned longnr_pages
231  se等于offset_to_swap_extent(si, start_page)
233 nr_pages循环
234  offset等于start_pagestart_page
235  start_block等于start_blockoffset
236  nr_blocks等于nr_pagesoffset
238  如果nr_blocks大于nr_pagesnr_blocks等于nr_pages
240  start_page加等于nr_blocks
241  nr_pages减等于nr_blocks
243  start_block左移等于PAGE_SHIFT determines the page size 减9位
244  nr_blocks左移等于PAGE_SHIFT determines the page size 减9位
245  如果blkdev_issue_discard(swap device or bdev of swap file , start_block, nr_blocks, GFP_NOIO, 0)则退出
249  se等于next_se(se)
调用者
名称描述
swap_do_scheduled_discardDoing discard actually. After a cluster discard is finished, the cluster* will be added to free cluster list. caller should hold si->lock.