2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015, Oracle and/or its affiliates. All Rights Reserved.
7 # Try to ENOSPC while expanding the refcntbt by CoWing every block
8 # of a file that eats the whole AG.
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
22 rm -rf $tmp.* $testdir
25 # get standard environment, filters and checks
30 # real QA test starts here
31 # Below agsize (16384 * $blksz) is too small for a large fs, and it's not
32 # necessary to test on large fs
33 _require_no_large_scratch_dev
34 _require_scratch_reflink
39 _scratch_mkfs >/dev/null 2>&1
41 _xfs_force_bdev data $SCRATCH_MNT
42 blksz=$(_get_file_block_size $SCRATCH_MNT)
45 echo "Format and mount"
46 _scratch_mkfs -d agsize=$((16384 * $blksz)) > $seqres.full 2>&1
47 _scratch_mount >> $seqres.full 2>&1
48 _xfs_force_bdev data $SCRATCH_MNT
50 testdir=$SCRATCH_MNT/test-$seq
53 echo "Create the original files"
54 sz=$((20480 * $blksz))
55 _pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
56 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
59 echo "CoW every other block"
60 _pwrite_byte 0x62 0 $sz $testdir/file1 >> $seqres.full
64 od -t x1 $testdir/file1 | _filter_od
65 od -t x1 $testdir/file2 | _filter_od
66 #filefrag -v $testdir/file1 $testdir/file2