Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\read_write.c Create Date:2022-07-28 20:01:30
Last Modify:2020-03-18 10:18:51 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Check that the two inodes are eligible for cloning, the ranges make* sense, and then flush all dirty data. Caller must ensure that the* inodes have been locked against any other modifications.

Proto:int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in, struct file *file_out, loff_t pos_out, loff_t *len, unsigned int remap_flags)

Type:int

Parameter:

TypeParameterName
struct file *file_in
loff_tpos_in
struct file *file_out
loff_tpos_out
loff_t *len
unsigned intremap_flags
1948  inode_in = file_inode(file_in)
1949  inode_out = file_inode(file_out)
1950  same_inode = inode_in == inode_out
1954  If IS_IMMUTABLE(inode_out) Then Return -EPERM
1957  If IS_SWAPFILE(inode_in) || IS_SWAPFILE(inode_out) Then Return -ETXTBSY
1961  If S_ISDIR(i_mode) || S_ISDIR(i_mode) Then Return -EISDIR
1963  If Not S_ISREG(i_mode) || Not S_ISREG(i_mode) Then Return -EINVAL
1967  If len == 0 Then
1968  isize = 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
1970  If remap_flags & These flags control the behavior of the remap_file_range function pointer.* If it is called with len == 0 that means "remap to end of source file".* See Documentation/filesystems/vfs.rst for more details about this call. || pos_in == isize Then Return 0
1972  If pos_in > isize Then Return -EINVAL
1974  len = isize - pos_in
1975  If len == 0 Then Return 0
1980  ret = Performs necessary checks before doing a clone.* Can adjust amount of bytes to clone via @req_count argument.* Returns appropriate error code that caller should return or* zero in case the clone should be allowed.
1982  If ret Then Return ret
1986  inode_dio_wait(inode_in)
1987  If Not same_inode Then inode_dio_wait(inode_out)
1990  ret = lemap_write_and_wait_range - write out & wait on a file range*@mapping: the address_space for the pages*@lstart: offset in bytes where the range starts*@lend: offset in bytes where the range ends (inclusive)
1992  If ret Then Return ret
1995  ret = lemap_write_and_wait_range - write out & wait on a file range*@mapping: the address_space for the pages*@lstart: offset in bytes where the range starts*@lend: offset in bytes where the range ends (inclusive)
1997  If ret Then Return ret
2003  If remap_flags & These flags control the behavior of the remap_file_range function pointer.* If it is called with len == 0 that means "remap to end of source file".* See Documentation/filesystems/vfs.rst for more details about this call. Then
2004  bool is_same = false
2006  ret = Compare extents of two files to see if they are the same.* Caller must have locked both inodes to prevent write races.
2008  If ret Then Return ret
2010  If Not is_same Then Return -EBADE
2014  ret = Ensure that we don't remap a partial EOF block in the middle of something* else. Assume that the offsets have already been checked for block* alignment.* For clone we only link a partial EOF block above or at the destination file's* EOF
2016  If ret Then Return ret
2020  If Not (remap_flags & These flags control the behavior of the remap_file_range function pointer.* If it is called with len == 0 that means "remap to end of source file".* See Documentation/filesystems/vfs.rst for more details about this call.) Then ret = file_modified(file_out)
2023  Return ret