btrfs: Add new test for setting the chunk size.
[xfstests-dev.git] / tests / generic / 223
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2010 Eric Sandeen.  All Rights Reserved.
4 #
5 # FS QA Test No. 223
6 #
7 # File alignment tests
8 #
9 . ./common/preamble
10 _begin_fstest auto quick
11
12 # Import common functions.
13 . ./common/filter
14
15 # real QA test starts here
16 _supported_fs generic
17
18 _require_scratch
19 _require_xfs_io_command "falloc"
20
21 BLOCKSIZE=4096
22
23 for SUNIT_K in 8 16 32 64 128; do
24         let SUNIT_BYTES=$SUNIT_K*1024
25         let SUNIT_BLOCKS=$SUNIT_BYTES/$BLOCKSIZE
26
27         echo "=== mkfs with su $SUNIT_BLOCKS blocks x 4 ==="
28         _scratch_mkfs_geom $SUNIT_BYTES 4 $BLOCKSIZE >> $seqres.full 2>&1
29         _scratch_mount
30
31         # This test checks for stripe alignments of space allocations on the
32         # filesystem.  Make sure all files get created on the main device,
33         # which for XFS means no rt files.
34         test "$FSTYP" = "xfs" && \
35                 _xfs_force_bdev data $SCRATCH_MNT
36
37         for SIZE_MULT in 1 2 8 64 256; do
38                 let SIZE=$SIZE_MULT*$SUNIT_BYTES
39
40                 echo "=== Testing size ${SIZE_MULT}*${SUNIT_K}k on ${SUNIT_K}k stripe ==="
41                 for FILE in 1 2 3 4; do
42                         $XFS_IO_PROG -f -c "falloc 0 $SIZE" \
43                                 $SCRATCH_MNT/file-$FILE-$SIZE-falloc \
44                                         >> $seqres.full 2>&1
45                         $XFS_IO_PROG -f -c "pwrite -b $SIZE 0 $SIZE" \
46                                 $SCRATCH_MNT/file-$FILE-$SIZE-write \
47                                         >> $seqres.full 2>&1
48                         $here/src/t_stripealign $SCRATCH_MNT/file-$FILE-$SIZE-falloc \
49                                 $SUNIT_BLOCKS | _filter_scratch
50                         $here/src/t_stripealign $SCRATCH_MNT/file-$FILE-$SIZE-write \
51                                 $SUNIT_BLOCKS | _filter_scratch
52                 done
53         done
54
55         echo "=== Testing size 1g falloc on ${SUNIT_K}k stripe ==="
56         $XFS_IO_PROG -f -c "falloc 0 1g" \
57             $SCRATCH_MNT/file-1g-falloc >> $seqres.full 2>&1
58         $here/src/t_stripealign $SCRATCH_MNT/file-1g-falloc $SUNIT_BLOCKS \
59             | _filter_scratch
60
61         rm -f $SCRATCH_MNT/file-1g-falloc | _filter_scratch
62
63         echo "=== Testing size 1073745920 falloc on ${SUNIT_K}k stripe ==="
64         $XFS_IO_PROG -f -c "falloc 0 1073745920" \
65                 $SCRATCH_MNT/file-1073745920-falloc >> $seqres.full 2>&1
66         $here/src/t_stripealign $SCRATCH_MNT/file-1073745920-falloc \
67                 $SUNIT_BLOCKS | _filter_scratch
68
69         _scratch_unmount
70 done
71
72 status=0
73 exit