2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Jaegeuk Kim. All Rights Reserved.
5 # FS QA Test No. f2fs/001
7 # Test inline_data behaviors when filesystem is full.
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/
13 # The basic idea is embedding small-sized file's data into relatively large
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.
19 seqres=$RESULT_DIR/$seq
20 echo "QA output created by $seq"
24 status=1 # failure is the default!
25 trap "_cleanup; exit \$status" 0 1 2 3 15
33 # get standard environment, filters and checks
41 testfile=$SCRATCH_MNT/testfile
42 dummyfile=$SCRATCH_MNT/dummyfile
44 # build 4GB filesystem
45 _scratch_mkfs_sized $((4 * 1024 * 1024 * 1024)) > /dev/null 2>&1
48 echo "==== create small file ===="
49 $XFS_IO_PROG -t -f -c "pwrite -S 0x58 0 40" $testfile | _filter_xfs_io
51 # -ENOSPC should be triggered
52 echo "==== Fullfill the partition ===="
53 $XFS_IO_PROG -t -f -c "falloc 0 5g" $dummyfile | _filter_xfs_io
55 # -ENOSPC should be triggered without any panic
56 echo "==== change i_size & write data ===="
57 $XFS_IO_PROG -c "truncate 96" -c "pwrite -S 0x58 8192 4096" $testfile 2>&1 \
58 | _filter_xfs_io_error
60 echo "==== check data contents ===="