-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathtrace_destroy.sh
More file actions
executable file
·42 lines (33 loc) · 978 Bytes
/
trace_destroy.sh
File metadata and controls
executable file
·42 lines (33 loc) · 978 Bytes
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
#!/usr/bin/bash
# Copyright 2016, Nexenta Systems, Inc.
#
# Watch in-progress synchronous ZFS destroys that were active at the time of starting the script.
#
# Determine which function to trace depending on whether we are on 3.x or 4.x
{
if [[ $(echo old_synchronous_dataset_destroy::whatis|mdb -k) == *"old_synchronous_dataset_destroy"* ]]
then
func="old_synchronous_dataset_destroy"
fi
if [[ $(echo dsl_dataset_destroy::whatis|mdb -k) == *"dsl_dataset_destroy"* ]]
then
func="dsl_dataset_destroy"
fi
} &> /dev/null
echo Tracing $func"()... Ctrl-C to exit."
update_threads () { threads=$(echo "::walk thread|::findstack -v"|mdb -k|grep $func| cut -d "(" -f 2 | cut -d "," -f 1); }
update_threads
while true
do
for thread in $threads
do
for i in {1..12}
do
date
echo "$thread::print -t dsl_dataset_t ds_dir | ::print -t struct dsl_dir dd_phys | ::print -t -d dsl_dir_phys_t dd_used_bytes" | mdb -k
sleep 5
done
update_threads
done
sleep 5
done