diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2018-10-29 19:41:56 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2018-10-29 19:41:56 -0400 |
commit | 452ce65951a2f0719e4e119ecca134c06cfe22ee (patch) | |
tree | 5b004e6b2ca558d80623963388a9c51acae04e5a /fs/read_write.c | |
parent | 42ec3d4c02187a18e27ff94b409ec27234bf2ffd (diff) |
vfs: plumb remap flags through the vfs clone functions
Plumb a remap_flags argument through the {do,vfs}_clone_file_range
functions so that clone can take advantage of it.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/read_write.c')
-rw-r--r-- | fs/read_write.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/read_write.c b/fs/read_write.c index 356641afa487..0d1ac1b9bc22 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -1848,12 +1848,15 @@ int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in, | |||
1848 | EXPORT_SYMBOL(generic_remap_file_range_prep); | 1848 | EXPORT_SYMBOL(generic_remap_file_range_prep); |
1849 | 1849 | ||
1850 | loff_t do_clone_file_range(struct file *file_in, loff_t pos_in, | 1850 | loff_t do_clone_file_range(struct file *file_in, loff_t pos_in, |
1851 | struct file *file_out, loff_t pos_out, loff_t len) | 1851 | struct file *file_out, loff_t pos_out, |
1852 | loff_t len, unsigned int remap_flags) | ||
1852 | { | 1853 | { |
1853 | struct inode *inode_in = file_inode(file_in); | 1854 | struct inode *inode_in = file_inode(file_in); |
1854 | struct inode *inode_out = file_inode(file_out); | 1855 | struct inode *inode_out = file_inode(file_out); |
1855 | loff_t ret; | 1856 | loff_t ret; |
1856 | 1857 | ||
1858 | WARN_ON_ONCE(remap_flags); | ||
1859 | |||
1857 | if (S_ISDIR(inode_in->i_mode) || S_ISDIR(inode_out->i_mode)) | 1860 | if (S_ISDIR(inode_in->i_mode) || S_ISDIR(inode_out->i_mode)) |
1858 | return -EISDIR; | 1861 | return -EISDIR; |
1859 | if (!S_ISREG(inode_in->i_mode) || !S_ISREG(inode_out->i_mode)) | 1862 | if (!S_ISREG(inode_in->i_mode) || !S_ISREG(inode_out->i_mode)) |
@@ -1884,7 +1887,7 @@ loff_t do_clone_file_range(struct file *file_in, loff_t pos_in, | |||
1884 | return ret; | 1887 | return ret; |
1885 | 1888 | ||
1886 | ret = file_in->f_op->remap_file_range(file_in, pos_in, | 1889 | ret = file_in->f_op->remap_file_range(file_in, pos_in, |
1887 | file_out, pos_out, len, 0); | 1890 | file_out, pos_out, len, remap_flags); |
1888 | if (ret < 0) | 1891 | if (ret < 0) |
1889 | return ret; | 1892 | return ret; |
1890 | 1893 | ||
@@ -1895,12 +1898,14 @@ loff_t do_clone_file_range(struct file *file_in, loff_t pos_in, | |||
1895 | EXPORT_SYMBOL(do_clone_file_range); | 1898 | EXPORT_SYMBOL(do_clone_file_range); |
1896 | 1899 | ||
1897 | loff_t vfs_clone_file_range(struct file *file_in, loff_t pos_in, | 1900 | loff_t vfs_clone_file_range(struct file *file_in, loff_t pos_in, |
1898 | struct file *file_out, loff_t pos_out, loff_t len) | 1901 | struct file *file_out, loff_t pos_out, |
1902 | loff_t len, unsigned int remap_flags) | ||
1899 | { | 1903 | { |
1900 | loff_t ret; | 1904 | loff_t ret; |
1901 | 1905 | ||
1902 | file_start_write(file_out); | 1906 | file_start_write(file_out); |
1903 | ret = do_clone_file_range(file_in, pos_in, file_out, pos_out, len); | 1907 | ret = do_clone_file_range(file_in, pos_in, file_out, pos_out, len, |
1908 | remap_flags); | ||
1904 | file_end_write(file_out); | 1909 | file_end_write(file_out); |
1905 | 1910 | ||
1906 | return ret; | 1911 | return ret; |