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:Accumulate iomaps for this swap file. We have to accumulate iomaps because* swap only cares about contiguous page-aligned physical extents and makes no* distinction between written and unwritten extents.

Proto:static loff_t iomap_swapfile_activate_actor(struct inode *inode, loff_t pos, loff_t count, void *data, struct iomap *iomap, struct iomap *srcmap)

Type:loff_t

Parameter:

TypeParameterName
struct inode *inode
loff_tpos
loff_tcount
void *data
struct iomap *iomap
struct iomap *srcmap
82  isi = data
86  Case type of mapping == locks allocated at @addr
87  Case type of mapping == locks allocated at @addr in unwritten state
89  Break
90  Case type of mapping == data inline in the inode
92  pr_err("swapon: file is inline\n")
93  Return -EINVAL
94  Default
95  pr_err("swapon: file has unallocated extents\n")
96  Return -EINVAL
100  If flags for mapping & IOMAP_F_DIRTY Then
101  pr_err("swapon: file is not committed\n")
102  Return -EINVAL
104  If flags for mapping & IOMAP_F_SHARED Then
105  pr_err("swapon: file has shared extents\n")
106  Return -EINVAL
110  If block device for I/O != swap device or bdev of swap file Then
111  pr_err("swapon: file is on multiple devices\n")
112  Return -EINVAL
115  If length of mapping, bytes == 0 Then
117  memcpy( & accumulated iomap , iomap, size of accumulated iomap )
118  Else if disk offset of mapping, bytes + length of mapping, bytes == disk offset of mapping, bytes Then
120  length of mapping, bytes += length of mapping, bytes
121  Else
123  error = 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
124  If error Then Return error
126  memcpy( & accumulated iomap , iomap, size of accumulated iomap )
128  Return count