Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\iomap\swapfile.c Create Date:2022-07-28 20:32:27
Last Modify:2020-03-18 11:03:10 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Iterate a swap file's iomaps to construct physical extents that can be* passed to the swapfile subsystem.

Proto:int iomap_swapfile_activate(struct swap_info_struct *sis, struct file *swap_file, sector_t *pagespan, const struct iomap_ops *ops)

Type:int

Parameter:

TypeParameterName
struct swap_info_struct *sis
struct file *swap_file
sector_t *pagespan
const struct iomap_ops *ops
139  struct iomap_swapfile_info isi = {sis = sis, lowest physical addr seen (pages) = (sector_t) - 1ULL, }
143  mapping = f_mapping
144  inode = host
145  pos = 0
146  len = ALIGN_DOWN(NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they , PAGE_SIZE)
153  ret = vfs_fsync - perform a fsync or fdatasync on a file*@file: file to sync*@datasync: only perform a fdatasync operation* Write back data and metadata for @file to disk. If @datasync is* set only metadata needed to access modified file data is written.
154  If ret Then Return ret
157  When len > 0 cycle
158  ret = Execute a iomap write on a segment of the mapping that spans a* contiguous range of pages that have identical block mapping state
160  If ret <= 0 Then Return ret
163  pos += ret
164  len -= ret
167  If length of mapping, bytes Then
168  ret = Collect 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
169  If ret Then Return ret
173  pagespan = 1 + highest physical addr seen (pages) - lowest physical addr seen (pages)
174  xtent of the swap_map = umber of pages collected
175  al of usable pages of swap = umber of pages collected - 1
176  dex of last free in swap_map = umber of pages collected - 1
177  Return xtent count