@@ -1452,7 +1452,11 @@ do_dedupe_range(unsigned offset, unsigned length, unsigned dest)
fdr->info[0].dest_fd = fd;
fdr->info[0].dest_offset = dest;
- if (ioctl(fd, FIDEDUPERANGE, fdr) == -1) {
+ if (ioctl(fd, FIDEDUPERANGE, fdr) == -1 ||
+ fdr->info[0].status < 0) {
+ if (fdr->info[0].status < 0)
+ errno = -fdr->info[0].status;
+
if (errno == EOPNOTSUPP || errno == ENOTTY) {
if (!quiet && testcalls > simulatedopcount)
prt("skipping unsupported dedupe range\n");
@@ -1486,6 +1490,11 @@ do_copy_range(unsigned offset, unsigned length, unsigned dest)
loff_t o1, o2;
ssize_t nr;
+ offset -= offset % readbdy;
+ dest -= dest % writebdy;
+ if (o_direct)
+ length -= length % readbdy;
+
if (length == 0) {
if (!quiet && testcalls > simulatedopcount)
prt("skipping zero length copy range\n");