4 # This file and its contents are supplied under the terms of the
5 # Common Development and Distribution License ("CDDL"), version 1.0.
6 # You may only use this file in accordance with the terms of version
9 # A full copy of the text of the CDDL should have accompanied this
10 # source. A copy of the CDDL is also available via the Internet at
11 # http://www.illumos.org/license/CDDL.
17 # Copyright (c) 2016 by Delphix. All rights reserved.
18 # Copyright (c) 2019 by Lawrence Livermore National Security, LLC.
21 function trim_prog_line # pool disk
25 zpool status -t "$pool" | grep "$disk" | grep "[[:digit:]]* trimmed"
28 function trim_progress # pool disk
30 trim_prog_line "$1" "$2" | sed 's/.*(\([0-9]\{1,\}\)% trimmed.*/\1/g'
34 # Write a bit of data and sync several times.
36 function sync_and_rewrite_some_data_a_few_times
39 typeset -i a_few_times=${2:-20}
41 typeset file="/$pool/tmpfile"
42 for i in {0..$a_few_times}; do
43 dd if=/dev/urandom of=${file} bs=128k count=10
52 if poolexists $TESTPOOL; then
53 destroy_pool $TESTPOOL
56 if poolexists $TESTPOOL1; then
57 destroy_pool $TESTPOOL1