5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or https://opensource.org/licenses/CDDL-1.0.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 2023 Klara, Inc.
32 . $STF_SUITE/include/libtest.shlib
33 . $STF_SUITE/tests/functional/cli_root/zpool_import/zpool_import.cfg
34 . $STF_SUITE/tests/functional/cli_root/zpool_import/zpool_import.kshlib
41 # Verify that pool imports can occur in parallel
45 # 2. Generate some ZIL records
47 # 4. Import half of the pools synchronously to baseline sequential cost
48 # 5. Import the other half asynchronously to demonstrate parallel savings
50 # 7. Test zpool import -a
53 verify_runnable "global"
56 # override the minimum sized vdevs
58 VDEVSIZE=$((512 * 1024 * 1024))
59 increase_device_sizes $VDEVSIZE
61 POOLNAME="import_pool"
66 log_must set_tunable64 KEEP_LOG_SPACEMAPS_AT_EXPORT 0
67 log_must set_tunable64 METASLAB_DEBUG_LOAD 0
69 for i in {0..$(($MAX_NUM - 1))}; do
70 destroy_pool $POOLNAME-$i
73 increase_device_sizes 0
74 increase_device_sizes $FILE_SIZE
77 log_assert "Pool imports can occur in parallel"
81 log_must set_tunable64 KEEP_LOG_SPACEMAPS_AT_EXPORT 1
82 log_must set_tunable64 METASLAB_DEBUG_LOAD 1
86 # create some exported pools with import delay injectors
88 for i in {0..$(($MAX_NUM - 1))}; do
89 log_must zpool create $POOLNAME-$i $DEVICE_DIR/${DEVICE_FILE}$i
90 log_must zpool export $POOLNAME-$i
91 log_must zinject -P import -s 12 $POOLNAME-$i
96 # import half of the pools synchronously
100 log_must zpool import -d $DEVICE_DIR -f $POOLNAME-$i
102 sequential_time=$SECONDS
103 log_note "sequentially imported 4 pools in $sequential_time seconds"
106 # import half of the pools in parallel
110 log_must zpool import -d $DEVICE_DIR -f $POOLNAME-$i &
113 parallel_time=$SECONDS
114 log_note "asyncronously imported 4 pools in $parallel_time seconds"
116 log_must test $parallel_time -lt $(($sequential_time / 3))
119 # export pools with import delay injectors
122 log_must zpool export $POOLNAME-$i
123 log_must zinject -P import -s 12 $POOLNAME-$i
128 # now test zpool import -a
131 log_must zpool import -a -d $DEVICE_DIR -f
132 parallel_time=$SECONDS
133 log_note "asyncronously imported 4 pools in $parallel_time seconds"
135 log_must test $parallel_time -lt $(($sequential_time / 3))
137 log_pass "Pool imports occur in parallel"