-print_jbd () {
- local file=$1
- local facet=$2
- local varsvc=${facet}_svc
- local dev=$(basename $(do_facet $facet lctl get_param -n *.${!varsvc}.mntdev))
-
- # ext4: /proc/fs/jbd2/sda1:8/history
- # ext3: /proc/fs/jbd/sdb1/history
-
- do_facet $facet cat /proc/fs/jbd*/${dev}*/$file
-}
-
-check_jbd_values () {
- local facet=$1
- local thrhi=$2
-
- # last two lines from history
- # $4: run >= 5000
- # $8: hndls >= thrhi * 2
- local hist=("$(print_jbd history $facet | tail -3 | head -2)")
- echo "$hist"
- local run=($(echo "${hist[*]}" | awk '{print $4}'))
- local hndls=($(echo "${hist[*]}" | awk '{print $8}'))
-
- local rc=0
- for (( i=0; i<1; i++)); do
- [[ ${run[i]} -lt 5000 ]] && \
- error "$facet: run expected 5000, have ${run[i]}" && rc=1
- [[ ${hndls[i]} -lt $((thrhi * 2)) ]] && \
- error "$facet: hndls expected > $((thrhi * 2)), have ${hndls[i]}" && rc=2
- done
- return $rc
-}
-
-check_jbd_values_facets () {
- local facets=$1
- local thrhi=$2
- local facet
- local rc=0
- for facet in ${facets//,/ }; do
- check_jbd_values $facet $thrhi || rc=$((rc+$?))
- done
- return $rc
-}
-