summaryrefslogtreecommitdiff
path: root/tests/generic/347
blob: 6799b8dadfa452c7a25e36bc5aed05d028c9acf3 (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
54
55
56
57
58
59
60
61
62
63
64
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2015 Red Hat, Inc.  All Rights Reserved.
#
# FS QA Test No. generic/347
#
# Test very basic thin device usage, exhaustion, and growth
#
#
. ./common/preamble
_begin_fstest auto quick rw thin

BACKING_SIZE=$((500 * 1024 * 1024 / 512))	# 500M
VIRTUAL_SIZE=$((10 * $BACKING_SIZE))		# 5000M
GROW_SIZE=$((100 * 1024 * 1024 / 512))		# 100M

# Override the default cleanup function.
_cleanup()
{
	_dmthin_cleanup
	rm -f $tmp.*
}

_setup_thin()
{
	_dmthin_init $BACKING_SIZE $VIRTUAL_SIZE
	_dmthin_set_queue
	_dmthin_mkfs
	_dmthin_mount
}

_workout()
{
	# Overfill it by a bit
	for I in `seq 1 500`; do
		$XFS_IO_PROG -f -c "pwrite -W 0 1M" $SCRATCH_MNT/file$I &>/dev/null
	done

	sync

	_dmthin_grow  $GROW_SIZE

	# Write a little more, but don't fill
	for I in `seq 501 510`; do
		$XFS_IO_PROG -f -c "pwrite 0 1M" $SCRATCH_MNT/file$I &>/dev/null
	done
}

# Import common functions.
. ./common/dmthin

_supported_fs generic
_require_scratch_nocheck
_require_dm_target thin-pool

_setup_thin
_workout
_dmthin_check_fs
_dmthin_cleanup

echo "=== completed"

status=0
exit