summaryrefslogtreecommitdiff
path: root/tests/generic/226
blob: 3443473076f74ddf8bc8122beed7fb3179153bb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2009 Eric Sandeen.  All Rights Reserved.
#
# FS QA Test No. 226
#
# Test for prealloc space leaks by rewriting the same file in a loop
#
. ./common/preamble
_begin_fstest auto enospc

# Import common functions.

_supported_fs generic
_require_scratch
_require_odirect

# real QA test starts here

_scratch_unmount 2>/dev/null
echo "--> mkfs 256m filesystem"
_scratch_mkfs_sized `expr 256 \* 1024 \* 1024` >> $seqres.full 2>&1
_scratch_mount

loops=16

# Buffer size argument supplied to xfs_io "pwrite" command
buffer="-b $(expr 512 \* 1024)"

echo "--> $loops buffered 64m writes in a loop"
for I in `seq 1 $loops`; do
	echo -n "$I "
	$XFS_IO_PROG -f \
		-c "pwrite ${buffer} 0 64m" $SCRATCH_MNT/test >> $seqres.full
	rm -f $SCRATCH_MNT/test
done

echo
_scratch_cycle_mount

echo "--> $loops direct 64m writes in a loop"
for I in `seq 1 $loops`; do
	echo -n "$I "
	$XFS_IO_PROG -f -d \
		-c "pwrite ${buffer} 0 64m" $SCRATCH_MNT/test >> $seqres.full
	rm -f $SCRATCH_MNT/test 
done

echo
_scratch_unmount

status=0
exit