Skip to content

Commit fba3e59

Browse files
djwongdchinner
authored andcommitted
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: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
1 parent cf7841c commit fba3e59

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

fs/xfs/xfs_reflink.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1317,8 +1317,14 @@ xfs_reflink_remap_range(
13171317
goto out_unlock;
13181318
}
13191319

1320-
if (len == 0)
1320+
/* Zero length dedupe exits immediately; reflink goes to EOF. */
1321+
if (len == 0) {
1322+
if (is_dedupe) {
1323+
ret = 0;
1324+
goto out_unlock;
1325+
}
13211326
len = isize - pos_in;
1327+
}
13221328

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

0 commit comments

Comments
 (0)