btrfs: punch holes and prealloc extents with send

This test verifies that after an incremental btrfs send the
replicated file has the same exact hole and data structure as in
the origin filesystem. This didn't use to be the case before the
send stream version 2 - holes were sent as write operations of 0
valued bytes instead of punching holes with the fallocate system
call, and pre-allocated extents were sent as well as write
operations of 0 valued bytes instead of intructions for the
receiver to use the fallocate system call.

It also checks that prealloc extents that lie beyond the file's
size are replicated by an incremental send.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
Filipe David Borba Manana
2014-04-22 10:45:53 +10:00
committed by Dave Chinner
parent cd444c6591
commit f81be18fa8
4 changed files with 167 additions and 0 deletions
+9
View File
@@ -2262,6 +2262,15 @@ _run_btrfs_util_prog()
run_check $BTRFS_UTIL_PROG $*
}
_require_btrfs_send_stream_version()
{
$BTRFS_UTIL_PROG send 2>&1 | \
grep '^[ \t]*\-\-stream\-version <version>' > /dev/null 2>&1
if [ $? -ne 0 ]; then
_notrun "Missing btrfs-progs send --stream-version command line option, skipped this test"
fi
}
init_rc()
{
if [ "$iam" == new ]