fstests: move test group info to test files
[xfstests-dev.git] / tests / f2fs / 001
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Jaegeuk Kim.  All Rights Reserved.
4 #
5 # FS QA Test No. f2fs/001
6 #
7 # Test inline_data behaviors when filesystem is full.
8 #
9 # The inline_data feature was introduced in ext4 and f2fs as follows.
10 #  ext4 : http://lwn.net/Articles/468678/
11 #  f2fs : http://lwn.net/Articles/573408/
12 #
13 # The basic idea is embedding small-sized file's data into relatively large
14 # inode space.
15 # In ext4, up to 132 bytes of data can be stored in 256 bytes-sized inode.
16 # In f2fs, up to 3.4KB of data can be embedded into 4KB-sized inode block.
17 #
18 . ./common/preamble
19 _begin_fstest auto quick rw
20
21 # Import common functions.
22 . ./common/filter
23
24 _supported_fs f2fs
25 _require_scratch
26 _require_xfs_io_command "falloc"
27
28 testfile=$SCRATCH_MNT/testfile
29 dummyfile=$SCRATCH_MNT/dummyfile
30
31 # build 4GB filesystem
32 _scratch_mkfs_sized $((4 * 1024 * 1024 * 1024)) > /dev/null 2>&1
33 _scratch_mount
34
35 echo "==== create small file ===="
36 $XFS_IO_PROG -t -f -c "pwrite -S 0x58 0 40" $testfile | _filter_xfs_io
37
38 # -ENOSPC should be triggered
39 echo "==== Fullfill the partition ===="
40 $XFS_IO_PROG -t -f -c "falloc 0 5g" $dummyfile | _filter_xfs_io
41
42 # -ENOSPC should be triggered without any panic
43 echo "==== change i_size & write data ===="
44 $XFS_IO_PROG -c "truncate 96" -c "pwrite -S 0x58 8192 4096" $testfile 2>&1 \
45         | _filter_xfs_io_error
46
47 echo "==== check data contents ===="
48 hexdump -C $testfile
49 _scratch_cycle_mount
50 hexdump -C $testfile
51
52 rm $testfile
53 rm $dummyfile
54
55 status=0
56 exit