函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\read_write.c Create Date:2022-07-29 10:31:33
Last Modify:2020-03-18 10:18:51 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Compare extents of two files to see if they are the same.* Caller must have locked both inodes to prevent write races.

函数原型:static int vfs_dedupe_file_range_compare(struct inode *src, loff_t srcoff, struct inode *dest, loff_t destoff, loff_t len, bool *is_same)

返回类型:int

参数:

类型参数名称
struct inode *src
loff_tsrcoff
struct inode *dest
loff_tdestoff
loff_tlen
bool *is_same
1868  error等于负EINVAL
1869  same = true
1870 len循环
1871  src_poff等于srcoff按位与PAGE_SIZE减1
1872  dest_poff等于destoff按位与PAGE_SIZE减1
1873  cmp_len等于两数取小(PAGE_SIZE - src_poff, PAGE_SIZE - dest_poff)
1875  cmp_len等于两数取小(cmp_len, len)
1876  如果cmp_len小于等于0则转到:out_error
1879  src_page等于Read a page's worth of file data into the page cache.
1880  如果是错误
1881  error等于错误
1882  转到:out_error
1884  dest_page等于Read a page's worth of file data into the page cache.
1885  如果是错误
1886  error等于错误
1888  转到:out_error
1891  Lock two pages, ensuring that we lock in offset order if the pages are from* the same file.
1901  same = false
1902  转到:unlock
1905  src_addr等于kmap_atomic(src_page)
1906  dest_addr等于kmap_atomic(dest_page)
1908  flush_dcache_page(src_page)
1909  flush_dcache_page(dest_page)
1911  如果memcmp(src_addr + src_poff, dest_addr + dest_poff, cmp_len)则same = false
1914  Prevent people trying to call kunmap_atomic() as if it were kunmap()* kunmap_atomic() should get the return value of kmap_atomic, not the page.(dest_addr)
1915  Prevent people trying to call kunmap_atomic() as if it were kunmap()* kunmap_atomic() should get the return value of kmap_atomic, not the page.(src_addr)
1916  unlock :
1917  Unlock two pages, being careful not to unlock the same page twice.
1918  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
1919  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
1921  如果非same退出
1924  srcoff加等于cmp_len
1925  destoff加等于cmp_len
1926  len减等于cmp_len
1929  is_same等于same
1930  返回:0
1932  out_error :
1933  返回:error
调用者
名称描述
generic_remap_file_range_prepCheck 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.