generic/554: hide permision warning on exfat
[xfstests-dev.git] / tests / generic / 359
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Oracle, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 359
6 #
7 # Make sure that the reference counting mechanism can handle the case
8 # where we share the first 1/4 of an extent with a file, share the
9 # last 1/4 of the extent with a second file, share the first half of
10 # the extent with N files, and share the second half of the extent
11 # with a different set of N files.  The key point here is to test that
12 # we handle the case where a refcount extent record doesn't coincide
13 # exactly with the block mapping records.
14 #
15 seq=`basename $0`
16 seqres=$RESULT_DIR/$seq
17 echo "QA output created by $seq"
18
19 here=`pwd`
20 tmp=/tmp/$$
21 status=1        # failure is the default!
22 trap "_cleanup; exit \$status" 0 1 2 3 7 15
23
24 _cleanup()
25 {
26         cd /
27         rm -rf $tmp.*
28         wait
29 }
30
31 # get standard environment, filters and checks
32 . ./common/rc
33 . ./common/filter
34 . ./common/reflink
35
36 # real QA test starts here
37 _require_scratch_reflink
38
39 echo "Format and mount"
40 _scratch_mkfs > $seqres.full 2>&1
41 _scratch_mount >> $seqres.full 2>&1
42
43 testdir=$SCRATCH_MNT/test-$seq
44 mkdir $testdir
45
46 blocks=64
47 blksz=65536
48 nr=4
49 halfway=$((blocks / 2 * blksz))
50 quarter=$((blocks / 4 * blksz))
51
52 echo "Initialize file"
53 _pwrite_byte 0x61 0 $((blocks * blksz)) $testdir/file >> $seqres.full
54
55 echo "Share the first half of the extent"
56 seq 1 $nr | while read nr; do
57         _reflink_range $testdir/file 0 $testdir/file$nr.0 0 $halfway >> $seqres.full
58 done
59
60 echo "Share the last half of the extent"
61 seq 1 $nr | while read nr; do
62         _reflink_range $testdir/file $halfway $testdir/file$nr.1 0 $halfway >> $seqres.full
63 done
64
65 echo "Share the first quarter of the extent"
66 _reflink_range $testdir/file 0 $testdir/file.2 0 $quarter >> $seqres.full
67
68 echo "Share the last quarter of the extent"
69 _reflink_range $testdir/file $((quarter * 3)) $testdir/file.3 0 $quarter >> $seqres.full
70
71 _scratch_cycle_mount
72
73 echo "Check output"
74 md5sum $testdir/file $testdir/file* | _filter_scratch
75
76 # success, all done
77 status=0
78 exit