d0e58ca455d1ab7f3152f4b16d0b306b4cddf61f
[xfstests-dev.git] / tests / generic / 620
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2020 Christian Kujau. All Rights Reserved.
4 # Copyright (c) 2020 Ritesh Harjani. All Rights Reserved.
5 #
6 # FS QA Test generic/620
7 #
8 # Since the test is not specific to ext4, hence adding it to generic.
9 #
10 # Add this test to check for regression which was reported when ext4 bmap aops
11 # was moved to use iomap APIs. jbd2 calls bmap() kernel function from
12 # fs/inode.c which was failing since iomap_bmap() implementation earlier
13 # returned 0 for block addr > INT_MAX.
14 #
15 # This regression was fixed with following kernel commit commit b75dfde1212
16 # ("fibmap: Warn and return an error in case of block > INT_MAX")
17 #
18 seq=`basename $0`
19 seqres=$RESULT_DIR/$seq
20 echo "QA output created by $seq"
21
22 here=`pwd`
23 tmp=/tmp/$$
24 status=1        # failure is the default!
25 trap "_cleanup; exit \$status" 0 1 2 3 15
26
27 _cleanup()
28 {
29         _dmhugedisk_cleanup
30         cd /
31         rm -f $tmp.*
32 }
33
34 # get standard environment, filters and checks
35 . ./common/rc
36 . ./common/filter
37 . ./common/dmhugedisk
38
39 # remove previous $seqres.full before test
40 rm -f $seqres.full
41
42 # Modify as appropriate.
43 _supported_fs generic
44 _require_scratch_16T_support
45 _require_scratch_size_nocheck $((4 * 1024 * 1024)) #kB
46 _require_dmhugedisk
47
48 # 17TB dm huge-test-zer0 device
49 # (in terms of 512 sectors)
50 sectors=$((2*1024*1024*1024*17))
51 chunk_size=128
52
53 _dmhugedisk_init $sectors $chunk_size
54 _mkfs_dev $DMHUGEDISK_DEV
55 _mount $DMHUGEDISK_DEV $SCRATCH_MNT || _fail "mount failed for $DMHUGEDISK_DEV $SCRATCH_MNT"
56 testfile=$SCRATCH_MNT/testfile-$seq
57
58 $XFS_IO_PROG -fc "pwrite -S 0xaa 0 1m" -c "fsync" $testfile | _filter_xfs_io
59
60 # success, all done
61 status=0
62 exit