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

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

xfs: always succeed when deduping zero bytes



It turns out that btrfs and xfs had differing interpretations of what
to do when the dedupe length is zero.  Change xfs to follow btrfs'
semantics so that the userland interface is consistent.

Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent cf7841c1
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1317,8 +1317,14 @@ xfs_reflink_remap_range(
		goto out_unlock;
	}

	if (len == 0)
	/* Zero length dedupe exits immediately; reflink goes to EOF. */
	if (len == 0) {
		if (is_dedupe) {
			ret = 0;
			goto out_unlock;
		}
		len = isize - pos_in;
	}

	/* Ensure offsets don't wrap and the input is inside i_size */
	if (pos_in + len < pos_in || pos_out + len < pos_out ||