Skip to content

Commit

Permalink
test-copy: use non-0 data block in copy_holes
Browse files Browse the repository at this point in the history
Some filesystems (e.g. zfs with compression!=off, which is the default
configuration) automatically hole-punch all-zero blocks ‒ write a block
full of ones instead
  • Loading branch information
nabijaczleweli authored and keszybz committed Mar 29, 2022
1 parent 53877d0 commit d66b77b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/test/test-copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ TEST_RET(copy_holes) {

assert_se(fstat(fd, &stat) >= 0);
blksz = stat.st_blksize;
buf = alloca0(blksz);
buf = alloca_safe(blksz);
memset(buf, 1, blksz);

/* We need to make sure to create hole in multiples of the block size, otherwise filesystems (btrfs)
* might silently truncate/extend the holes. */
Expand Down

0 comments on commit d66b77b

Please sign in to comment.