mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
reflink: refactor mixed block creation code
Refactor the code that creates files with mixed block types that we feed into CoW tests to make sure that we can tiptoe around that kind of stuff. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
+1
-7
@@ -63,13 +63,7 @@ mkdir $testdir
|
||||
echo "Create the original files"
|
||||
blksz=65536
|
||||
nr=64
|
||||
_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
|
||||
$XFS_IO_PROG -f -c "falloc 0 $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
|
||||
seq 0 2 $((nr-1)) | while read f; do
|
||||
_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_weave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
|
||||
+1
-7
@@ -63,13 +63,7 @@ mkdir $testdir
|
||||
echo "Create the original files"
|
||||
blksz=65536
|
||||
nr=64
|
||||
_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
|
||||
$XFS_IO_PROG -f -c "falloc 0 $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
|
||||
seq 0 2 $((nr-1)) | while read f; do
|
||||
_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_weave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
|
||||
+1
-7
@@ -63,13 +63,7 @@ mkdir $testdir
|
||||
echo "Create the original files"
|
||||
blksz=65536
|
||||
nr=64
|
||||
_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
|
||||
$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
|
||||
seq 0 2 $((nr-1)) | while read f; do
|
||||
_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
|
||||
+1
-7
@@ -63,13 +63,7 @@ mkdir $testdir
|
||||
echo "Create the original files"
|
||||
blksz=65536
|
||||
nr=64
|
||||
_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
|
||||
$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
|
||||
seq 0 2 $((nr-1)) | while read f; do
|
||||
_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
|
||||
+2
-11
@@ -64,13 +64,7 @@ mkdir $testdir
|
||||
echo "Create the original files"
|
||||
blksz=65536
|
||||
nr=64
|
||||
_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
|
||||
$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
|
||||
seq 0 2 $((nr-1)) | while read f; do
|
||||
_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
@@ -79,10 +73,7 @@ md5sum "$testdir/file3" | _filter_scratch
|
||||
md5sum "$testdir/file3.chk" | _filter_scratch
|
||||
|
||||
echo "directio CoW across the transition"
|
||||
seq 1 2 $((nr-1)) | while read f; do
|
||||
_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_weave_reflink_holes_delalloc $blksz $nr $testdir/file3 >> $seqres.full
|
||||
"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
|
||||
_scratch_remount
|
||||
|
||||
+2
-11
@@ -64,13 +64,7 @@ mkdir $testdir
|
||||
echo "Create the original files"
|
||||
blksz=65536
|
||||
nr=64
|
||||
_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
|
||||
$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
|
||||
seq 0 2 $((nr-1)) | while read f; do
|
||||
_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
@@ -79,10 +73,7 @@ md5sum "$testdir/file3" | _filter_scratch
|
||||
md5sum "$testdir/file3.chk" | _filter_scratch
|
||||
|
||||
echo "CoW across the transition"
|
||||
seq 1 2 $((nr-1)) | while read f; do
|
||||
_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_weave_reflink_holes_delalloc $blksz $nr $testdir/file3 >> $seqres.full
|
||||
"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
|
||||
_scratch_remount
|
||||
|
||||
+1
-7
@@ -63,13 +63,7 @@ mkdir $testdir
|
||||
echo "Create the original files"
|
||||
blksz=65536
|
||||
nr=64
|
||||
_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
|
||||
_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
|
||||
seq 0 2 $((nr-1)) | while read f; do
|
||||
_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_weave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
|
||||
+1
-7
@@ -63,13 +63,7 @@ mkdir $testdir
|
||||
echo "Create the original files"
|
||||
blksz=65536
|
||||
nr=64
|
||||
_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
|
||||
_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
|
||||
seq 0 2 $((nr-1)) | while read f; do
|
||||
_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_weave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
|
||||
+2
-29
@@ -69,30 +69,7 @@ mkdir $testdir
|
||||
echo "Create the original files"
|
||||
blksz=65536
|
||||
nr=64
|
||||
_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
|
||||
$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
|
||||
# 0 blocks are reflinked
|
||||
seq 0 5 $nr | while read f; do
|
||||
_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
sync
|
||||
# 1 blocks are unwritten
|
||||
seq 1 5 $nr | while read f; do
|
||||
$XFS_IO_PROG -f -c "falloc $((blksz * f)) $blksz" "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x00 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
sync
|
||||
# 2 blocks are holes
|
||||
seq 2 5 $nr | while read f; do
|
||||
_pwrite_byte 0x00 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
# 3 blocks are regular
|
||||
seq 3 5 $nr | while read f; do
|
||||
_pwrite_byte 0x71 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x71 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
sync
|
||||
_weave_reflink_rainbow $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
@@ -101,11 +78,7 @@ md5sum "$testdir/file3" | _filter_scratch
|
||||
md5sum "$testdir/file3.chk" | _filter_scratch
|
||||
|
||||
echo "directio CoW across the transition"
|
||||
# 4 blocks are delalloc (do later)
|
||||
seq 4 5 $nr | while read f; do
|
||||
_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_weave_reflink_rainbow_delalloc $blksz $nr $testdir/file3 >> $seqres.full
|
||||
# now cow
|
||||
"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
|
||||
|
||||
@@ -8,5 +8,5 @@ bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-199/file1
|
||||
directio CoW across the transition
|
||||
Compare files
|
||||
bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-199/file1
|
||||
36f6b5317a9a921fc91175390ccf7f69 SCRATCH_MNT/test-199/file3
|
||||
36f6b5317a9a921fc91175390ccf7f69 SCRATCH_MNT/test-199/file3.chk
|
||||
26aa3a0749b867ec58363c8539ee5471 SCRATCH_MNT/test-199/file3
|
||||
26aa3a0749b867ec58363c8539ee5471 SCRATCH_MNT/test-199/file3.chk
|
||||
|
||||
+2
-29
@@ -69,30 +69,7 @@ mkdir $testdir
|
||||
echo "Create the original files"
|
||||
blksz=65536
|
||||
nr=64
|
||||
_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
|
||||
$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
|
||||
# 0 blocks are reflinked
|
||||
seq 0 5 $nr | while read f; do
|
||||
_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
sync
|
||||
# 1 blocks are unwritten
|
||||
seq 1 5 $nr | while read f; do
|
||||
$XFS_IO_PROG -f -c "falloc $((blksz * f)) $blksz" "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x00 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
sync
|
||||
# 2 blocks are holes
|
||||
seq 2 5 $nr | while read f; do
|
||||
_pwrite_byte 0x00 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
# 3 blocks are regular
|
||||
seq 3 5 $nr | while read f; do
|
||||
_pwrite_byte 0x71 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x71 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
sync
|
||||
_weave_reflink_rainbow $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
@@ -101,11 +78,7 @@ md5sum "$testdir/file3" | _filter_scratch
|
||||
md5sum "$testdir/file3.chk" | _filter_scratch
|
||||
|
||||
echo "directio CoW across the transition"
|
||||
# 4 blocks are delalloc (do later)
|
||||
seq 4 5 $nr | while read f; do
|
||||
_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_weave_reflink_rainbow_delalloc $blksz $nr $testdir/file3 >> $seqres.full
|
||||
# now cow
|
||||
"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
|
||||
|
||||
@@ -8,5 +8,5 @@ bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-200/file1
|
||||
directio CoW across the transition
|
||||
Compare files
|
||||
bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-200/file1
|
||||
36f6b5317a9a921fc91175390ccf7f69 SCRATCH_MNT/test-200/file3
|
||||
36f6b5317a9a921fc91175390ccf7f69 SCRATCH_MNT/test-200/file3.chk
|
||||
26aa3a0749b867ec58363c8539ee5471 SCRATCH_MNT/test-200/file3
|
||||
26aa3a0749b867ec58363c8539ee5471 SCRATCH_MNT/test-200/file3.chk
|
||||
|
||||
Reference in New Issue
Block a user