2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Red Hat Inc. All Rights Reserved.
5 # FS QA Test generic/559
7 # Dedupe a single big file and verify integrity
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
24 # get standard environment, filters and checks
29 # remove previous $seqres.full before test
32 # real QA test starts here
35 _require_scratch_duperemove
37 fssize=$((2 * 1024 * 1024 * 1024))
38 _scratch_mkfs_sized $fssize > $seqres.full 2>&1
39 _scratch_mount >> $seqres.full 2>&1
41 # fill the fs with a big file has same contents
42 $XFS_IO_PROG -f -c "pwrite -S 0x55 0 $fssize" $SCRATCH_MNT/${seq}.file \
44 md5sum $SCRATCH_MNT/${seq}.file > ${tmp}.md5sum
46 echo "= before cycle mount ="
47 # Dedupe with 1M blocksize
48 $DUPEREMOVE_PROG -dr --dedupe-options=same -b 1048576 $SCRATCH_MNT/ >>$seqres.full 2>&1
50 md5sum -c --quiet ${tmp}.md5sum
51 # Dedupe with 64k blocksize
52 $DUPEREMOVE_PROG -dr --dedupe-options=same -b 65536 $SCRATCH_MNT/ >>$seqres.full 2>&1
53 # Verify integrity again
54 md5sum -c --quiet ${tmp}.md5sum
56 # umount and mount again, verify pagecache contents don't mutate
58 echo "= after cycle mount ="
59 md5sum -c --quiet ${tmp}.md5sum