tests: remove udf/101
[xfstests-dev.git] / tests / f2fs / 001
1 #! /bin/bash
2 # FS QA Test No. f2fs/001
3 #
4 # Test inline_data behaviors when filesystem is full.
5 #
6 # The inline_data feature was introduced in ext4 and f2fs as follows.
7 #  ext4 : http://lwn.net/Articles/468678/
8 #  f2fs : http://lwn.net/Articles/573408/
9 #
10 # The basic idea is embedding small-sized file's data into relatively large
11 # inode space.
12 # In ext4, up to 132 bytes of data can be stored in 256 bytes-sized inode.
13 # In f2fs, up to 3.4KB of data can be embedded into 4KB-sized inode block.
14 #
15 #-----------------------------------------------------------------------
16 # Copyright (c) 2014 Jaegeuk Kim.  All Rights Reserved.
17 #
18 # This program is free software; you can redistribute it and/or
19 # modify it under the terms of the GNU General Public License as
20 # published by the Free Software Foundation.
21 #
22 # This program is distributed in the hope that it would be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 # GNU General Public License for more details.
26 #
27 # You should have received a copy of the GNU General Public License
28 # along with this program; if not, write the Free Software Foundation,
29 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
30 #-----------------------------------------------------------------------
31 #
32
33 seq=`basename $0`
34 seqres=$RESULT_DIR/$seq
35 echo "QA output created by $seq"
36
37 here=`pwd`
38 tmp=/tmp/$$
39 status=1        # failure is the default!
40 trap "_cleanup; exit \$status" 0 1 2 3 15
41
42 _cleanup()
43 {
44     cd /
45     rm -f $tmp.*
46 }
47
48 # get standard environment, filters and checks
49 . ./common/rc
50 . ./common/filter
51
52 _supported_fs f2fs
53 _supported_os Linux
54 _require_scratch
55
56 testfile=$SCRATCH_MNT/testfile
57 dummyfile=$SCRATCH_MNT/dummyfile
58
59 # build 4GB filesystem
60 _scratch_mkfs_sized $((4 * 1024 * 1024 * 1024)) > /dev/null 2>&1
61 _scratch_mount
62
63 echo "==== create small file ===="
64 $XFS_IO_PROG -t -f -c "pwrite -S 0x58 0 40" $testfile | _filter_xfs_io
65
66 # -ENOSPC should be triggered
67 echo "==== Fullfill the partition ===="
68 $XFS_IO_PROG -t -f -c "falloc 0 5g" $dummyfile | _filter_xfs_io
69
70 # -ENOSPC should be triggered without any panic
71 echo "==== change i_size & write data ===="
72 $XFS_IO_PROG -c "truncate 96" -c "pwrite -S 0x58 8192 4096" $testfile 2>&1 \
73         | _filter_xfs_io_error
74
75 echo "==== check data contents ===="
76 hexdump -C $testfile
77 _scratch_cycle_mount
78 hexdump -C $testfile
79
80 rm $testfile
81 rm $dummyfile
82
83 status=0
84 exit