Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a91ae49b authored by Darrick J. Wong's avatar Darrick J. Wong Committed by Dave Chinner
Browse files

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: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarAmir Goldstein <amir73il@gmail.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 2e5dfc99
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2538,7 +2538,7 @@ static int ocfs2_remap_file_range(struct file *file_in,
		return -EINVAL;

	return ocfs2_reflink_remap_range(file_in, pos_in, file_out, pos_out,
					 len, remap_flags & REMAP_FILE_DEDUP);
					 len, remap_flags);
}

const struct inode_operations ocfs2_file_iops = {
+2 −2
Original line number Diff line number Diff line
@@ -4825,7 +4825,7 @@ int ocfs2_reflink_remap_range(struct file *file_in,
			      struct file *file_out,
			      loff_t pos_out,
			      u64 len,
			      bool is_dedupe)
			      unsigned int remap_flags)
{
	struct inode *inode_in = file_inode(file_in);
	struct inode *inode_out = file_inode(file_out);
@@ -4851,7 +4851,7 @@ int ocfs2_reflink_remap_range(struct file *file_in,
		goto out_unlock;

	ret = generic_remap_file_range_prep(file_in, pos_in, file_out, pos_out,
			&len, is_dedupe);
			&len, remap_flags);
	if (ret <= 0)
		goto out_unlock;

+1 −1
Original line number Diff line number Diff line
@@ -120,6 +120,6 @@ int ocfs2_reflink_remap_range(struct file *file_in,
			      struct file *file_out,
			      loff_t pos_out,
			      u64 len,
			      bool is_dedupe);
			      unsigned int remap_flags);

#endif /* OCFS2_REFCOUNTTREE_H */
+7 −7
Original line number Diff line number Diff line
@@ -1722,14 +1722,14 @@ static int generic_remap_check_len(struct inode *inode_in,
				   struct inode *inode_out,
				   loff_t pos_out,
				   u64 *len,
				   bool is_dedupe)
				   unsigned int remap_flags)
{
	u64 blkmask = i_blocksize(inode_in) - 1;

	if ((*len & blkmask) == 0)
		return 0;

	if (is_dedupe)
	if (remap_flags & REMAP_FILE_DEDUP)
		*len &= ~blkmask;
	else if (pos_out + *len < i_size_read(inode_out))
		return -EINVAL;
@@ -1747,7 +1747,7 @@ static int generic_remap_check_len(struct inode *inode_in,
 */
int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in,
				  struct file *file_out, loff_t pos_out,
				  u64 *len, bool is_dedupe)
				  u64 *len, unsigned int remap_flags)
{
	struct inode *inode_in = file_inode(file_in);
	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,
	if (*len == 0) {
		loff_t isize = i_size_read(inode_in);

		if (is_dedupe || pos_in == isize)
		if ((remap_flags & REMAP_FILE_DEDUP) || pos_in == isize)
			return 0;
		if (pos_in > isize)
			return -EINVAL;
@@ -1782,7 +1782,7 @@ int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in,

	/* Check that we don't violate system file offset limits. */
	ret = generic_remap_checks(file_in, pos_in, file_out, pos_out, len,
			is_dedupe);
			(remap_flags & REMAP_FILE_DEDUP));
	if (ret)
		return ret;

@@ -1804,7 +1804,7 @@ int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in,
	/*
	 * Check that the extents are the same.
	 */
	if (is_dedupe) {
	if (remap_flags & REMAP_FILE_DEDUP) {
		bool		is_same = false;

		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,
	}

	ret = generic_remap_check_len(inode_in, inode_out, pos_out, len,
			is_dedupe);
			remap_flags);
	if (ret)
		return ret;

+1 −1
Original line number Diff line number Diff line
@@ -932,7 +932,7 @@ xfs_file_remap_range(
		return -EINVAL;

	return xfs_reflink_remap_range(file_in, pos_in, file_out, pos_out,
			len, remap_flags & REMAP_FILE_DEDUP);
			len, remap_flags);
}

STATIC int
Loading