-# jbd_stats collector
-#
-# JBD_INVERVAL:
-# - 0 - collect at start and stop only
-# - N - isn't implemented yet, works as with 0
-#
-function jbd_collector()
-{
- local obd=$1
- local uuid=$(cat $obd/uuid)
- local tmp=$(cat $obd/mntdev)
- local disk=$(basename $tmp)
- local file="/proc/fs/jbd/${disk}/history"
-
- echo "jbd history for ${uuid}/${disk} " $(date)
-
- if let "JBD_INTERVAL==0"; then
- idle_collector
- cat $file
- elif let "JBD_INTERVAL>0"; then
- idle_collector
- cat $file
- else
- echo "Invalid JBD_INTERVAL=$JBD_INTERVAL"
- idle_collector
- fi
-}
-
-function jbd_start()
-{
- if [ "$JBD_INTERVAL" == "" ]; then
- return;
- fi
-
- # find all obdfilters and MDSs
- for i in /proc/fs/lustre/obdfilter/* /proc/fs/lustre/mds/*; do
- local obd=$(basename $i)
- if [ "$obd" == "num_refs" ]; then
- continue;
- fi
- if [ ! -f ${i}/mntdev ]; then
- continue;
- fi
- local tmp=$(cat ${i}/mntdev)
- local disk=$(basename $tmp)
- if [ ! -f /proc/fs/jbd/${disk}/history ]; then
- continue;
- fi
- run_collector "jbd" jbd_collector ${i} &
- done
-}
-
-#