diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2018-10-29 19:41:28 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2018-10-29 19:41:28 -0400 |
commit | a91ae49bbaf43910edb09e03fedf26b23875bd52 (patch) | |
tree | 8152c5568a957e47b986e25324846e06a6d1fd57 /fs/read_write.c | |
parent | 2e5dfc99f2e61c42083ba742395e7a7b353513d1 (diff) |
vfs: pass remap flags to generic_remap_file_range_prep
Plumb the remap flags through the filesystem from the vfs function
dispatcher all the way to the prep function to prepare for behavior
changes in subsequent patches.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/read_write.c')
-rw-r--r-- | fs/read_write.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/read_write.c b/fs/read_write.c index 766bdcb381f3..201381689284 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -1722,14 +1722,14 @@ static int generic_remap_check_len(struct inode *inode_in, | |||
1722 | struct inode *inode_out, | 1722 | struct inode *inode_out, |
1723 | loff_t pos_out, | 1723 | loff_t pos_out, |
1724 | u64 *len, | 1724 | u64 *len, |
1725 | bool is_dedupe) | 1725 | unsigned int remap_flags) |
1726 | { | 1726 | { |
1727 | u64 blkmask = i_blocksize(inode_in) - 1; | 1727 | u64 blkmask = i_blocksize(inode_in) - 1; |
1728 | 1728 | ||
1729 | if ((*len & blkmask) == 0) | 1729 | if ((*len & blkmask) == 0) |
1730 | return 0; | 1730 | return 0; |
1731 | 1731 | ||
1732 | if (is_dedupe) | 1732 | if (remap_flags & REMAP_FILE_DEDUP) |
1733 | *len &= ~blkmask; | 1733 | *len &= ~blkmask; |
1734 | else if (pos_out + *len < i_size_read(inode_out)) | 1734 | else if (pos_out + *len < i_size_read(inode_out)) |
1735 | return -EINVAL; | 1735 | return -EINVAL; |
@@ -1747,7 +1747,7 @@ static int generic_remap_check_len(struct inode *inode_in, | |||
1747 | */ | 1747 | */ |
1748 | int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in, | 1748 | int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in, |
1749 | struct file *file_out, loff_t pos_out, | 1749 | struct file *file_out, loff_t pos_out, |
1750 | u64 *len, bool is_dedupe) | 1750 | u64 *len, unsigned int remap_flags) |
1751 | { | 1751 | { |
1752 | struct inode *inode_in = file_inode(file_in); | 1752 | struct inode *inode_in = file_inode(file_in); |
1753 | struct inode *inode_out = file_inode(file_out); | 1753 | struct inode *inode_out = file_inode(file_out); |
@@ -1771,7 +1771,7 @@ int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in, | |||
1771 | if (*len == 0) { | 1771 | if (*len == 0) { |
1772 | loff_t isize = i_size_read(inode_in); | 1772 | loff_t isize = i_size_read(inode_in); |
1773 | 1773 | ||
1774 | if (is_dedupe || pos_in == isize) | 1774 | if ((remap_flags & REMAP_FILE_DEDUP) || pos_in == isize) |
1775 | return 0; | 1775 | return 0; |
1776 | if (pos_in > isize) | 1776 | if (pos_in > isize) |
1777 | return -EINVAL; | 1777 | return -EINVAL; |
@@ -1782,7 +1782,7 @@ int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in, | |||
1782 | 1782 | ||
1783 | /* Check that we don't violate system file offset limits. */ | 1783 | /* Check that we don't violate system file offset limits. */ |
1784 | ret = generic_remap_checks(file_in, pos_in, file_out, pos_out, len, | 1784 | ret = generic_remap_checks(file_in, pos_in, file_out, pos_out, len, |
1785 | is_dedupe); | 1785 | (remap_flags & REMAP_FILE_DEDUP)); |
1786 | if (ret) | 1786 | if (ret) |
1787 | return ret; | 1787 | return ret; |
1788 | 1788 | ||
@@ -1804,7 +1804,7 @@ int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in, | |||
1804 | /* | 1804 | /* |
1805 | * Check that the extents are the same. | 1805 | * Check that the extents are the same. |
1806 | */ | 1806 | */ |
1807 | if (is_dedupe) { | 1807 | if (remap_flags & REMAP_FILE_DEDUP) { |
1808 | bool is_same = false; | 1808 | bool is_same = false; |
1809 | 1809 | ||
1810 | ret = vfs_dedupe_file_range_compare(inode_in, pos_in, | 1810 | ret = vfs_dedupe_file_range_compare(inode_in, pos_in, |
@@ -1816,7 +1816,7 @@ int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in, | |||
1816 | } | 1816 | } |
1817 | 1817 | ||
1818 | ret = generic_remap_check_len(inode_in, inode_out, pos_out, len, | 1818 | ret = generic_remap_check_len(inode_in, inode_out, pos_out, len, |
1819 | is_dedupe); | 1819 | remap_flags); |
1820 | if (ret) | 1820 | if (ret) |
1821 | return ret; | 1821 | return ret; |
1822 | 1822 | ||