]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tests/zfs-tests/tests/functional/arc/arcstats_runtime_tuning.ksh
Vendor import of openzfs master @ 184df27eef0abdc7ab2105b21257f753834b936b
[FreeBSD/FreeBSD.git] / tests / zfs-tests / tests / functional / arc / arcstats_runtime_tuning.ksh
1 #!/bin/ksh -p
2 #
3 # This file and its contents are supplied under the terms of the
4 # Common Development and Distribution License ("CDDL"), version 1.0.
5 # You may only use this file in accordance with the terms of version
6 # 1.0 of the CDDL.
7 #
8 # A full copy of the text of the CDDL should have accompanied this
9 # source.  A copy of the CDDL is also available via the Internet at
10 # http://www.illumos.org/license/CDDL.
11 #
12
13 #
14 # Copyright 2019, loli10K <ezomori.nozomu@gmail.com>. All rights reserved.
15 #
16
17 . $STF_SUITE/include/libtest.shlib
18 . $STF_SUITE/tests/perf/perf.shlib
19
20 function cleanup
21 {
22         # Set tunables to their recorded actual size and then to their original
23         # value: this works for previously unconfigured tunables.
24         log_must set_tunable64 ARC_MIN "$MINSIZE"
25         log_must set_tunable64 ARC_MIN "$ZFS_ARC_MIN"
26         log_must set_tunable64 ARC_MAX "$MAXSIZE"
27         log_must set_tunable64 ARC_MAX "$ZFS_ARC_MAX"
28 }
29
30 log_onexit cleanup
31
32 ZFS_ARC_MAX="$(get_tunable ARC_MAX)"
33 ZFS_ARC_MIN="$(get_tunable ARC_MIN)"
34 MINSIZE="$(get_min_arc_size)"
35 MAXSIZE="$(get_max_arc_size)"
36
37 log_assert "ARC tunables should be updated dynamically"
38
39 for size in $((MAXSIZE/4)) $((MAXSIZE/3)) $((MAXSIZE/2)) $MAXSIZE; do
40         log_must set_tunable64 ARC_MAX "$size"
41         log_must test "$(get_max_arc_size)" == "$size"
42         log_must set_tunable64 ARC_MIN "$size"
43         log_must test "$(get_min_arc_size)" == "$size"
44 done
45
46 log_pass "ARC tunables can be updated dynamically"