xfs/139: work with 1k block size
[xfstests-dev.git] / tests / xfs / 139
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 139
6 #
7 # Try to ENOSPC while expanding the refcntbt by CoWing every block
8 # of a file that eats the whole AG.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16 status=1    # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 _cleanup()
20 {
21     cd /
22     rm -rf $tmp.* $testdir
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28 . ./common/reflink
29
30 # real QA test starts here
31 _supported_os Linux
32 _require_scratch_reflink
33 _require_cp_reflink
34
35 rm -f $seqres.full
36
37 _scratch_mkfs >/dev/null 2>&1
38 _scratch_mount
39 blksz=$(_get_file_block_size $SCRATCH_MNT)
40 _scratch_unmount
41
42 echo "Format and mount"
43 _scratch_mkfs -d agsize=$((16384 * $blksz)) > $seqres.full 2>&1
44 _scratch_mount >> $seqres.full 2>&1
45
46 testdir=$SCRATCH_MNT/test-$seq
47 mkdir $testdir
48
49 echo "Create the original files"
50 sz=$((20480 * $blksz))
51 _pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
52 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
53 _scratch_cycle_mount
54
55 echo "CoW every other block"
56 _pwrite_byte 0x62 0 $sz $testdir/file1 >> $seqres.full
57 _scratch_cycle_mount
58
59 echo "Compare files"
60 od -t x1 $testdir/file1 | _filter_od
61 od -t x1 $testdir/file2 | _filter_od
62 #filefrag -v $testdir/file1 $testdir/file2
63
64 # success, all done
65 status=0
66 exit