}
wait_delete_completed () {
- local TOTALPREV=`awk 'BEGIN{total=0}; {total+=$1}; END{print total}' \
- $LPROC/osc/*/kbytesavail`
+ local TOTALPREV=`lctl get_param -n osc.*.kbytesavail | \
+ awk 'BEGIN{total=0}; {total+=$1}; END{print total}'`
local WAIT=0
local MAX_WAIT=20
while [ "$WAIT" -ne "$MAX_WAIT" ]; do
sleep 1
- TOTAL=`awk 'BEGIN{total=0}; {total+=$1}; END{print total}' \
- $LPROC/osc/*/kbytesavail`
+ TOTAL=`lctl get_param -n osc.*.kbytesavail | \
+ awk 'BEGIN{total=0}; {total+=$1}; END{print total}'`
[ "$TOTAL" -eq "$TOTALPREV" ] && break
echo "Waiting delete completed ... prev: $TOTALPREV current: $TOTAL "
TOTALPREV=$TOTAL
MAX=$(( timeout * 4 ))
WAIT=0
while [ $WAIT -lt $MAX ]; do
- STATUS=`do_facet mds grep status /proc/fs/lustre/mds/*-MDT*/recovery_status`
+ STATUS=`do_facet mds "lctl get_param -n mds.*-MDT*.recovery_status | grep status"`
echo $STATUS | grep COMPLETE && return 0
sleep 5
WAIT=$((WAIT + 5))
}
mds_evict_client() {
- UUID=`cat /proc/fs/lustre/mdc/${mds_svc}-mdc-*/uuid`
- do_facet mds "echo $UUID > /proc/fs/lustre/mds/${mds_svc}/evict_client"
+ UUID=`lctl get_param -n mdc.${mds_svc}-mdc-*.uuid`
+ do_facet mds "lctl set_param -n mds.${mds_svc}.evict_client $UUID"
}
ost_evict_client() {
- UUID=`cat /proc/fs/lustre/osc/${ost1_svc}-osc-*/uuid`
- do_facet ost1 "echo $UUID > /proc/fs/lustre/obdfilter/${ost1_svc}/evict_client"
+ UUID=`lctl get_param -n osc.${ost1_svc}-osc-*.uuid`
+ do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.evict_client $UUID"
}
fail() {
cancel_lru_locks() {
$LCTL mark "cancel_lru_locks $1 start"
- for d in `find $LPROC/ldlm/namespaces | egrep -i $1`; do
- [ -f $d/lru_size ] && echo clear > $d/lru_size
- [ -f $d/lock_unused_count ] && grep [1-9] $d/lock_unused_count /dev/null
- done
+ lctl set_param ldlm.namespaces.*$1*.lru_size=0
+ lctl get_param ldlm.namespaces.*$1*.lock_unused_count | grep -v '=0'
$LCTL mark "cancel_lru_locks $1 stop"
}
lru_resize_enable()
{
- NS=$1
- test "x$NS" = "x" && NS="mdc"
- for F in $LPROC/ldlm/namespaces/*$NS*/lru_size; do
- D=$(dirname $F)
- log "Enable lru resize for $(basename $D)"
- echo "0" > $F
- done
+ lctl set_param ldlm.namespaces.*$1*.lru_size=0
}
lru_resize_disable()
{
- NS=$1
- test "x$NS" = "x" && NS="mdc"
- for F in $LPROC/ldlm/namespaces/*$NS*/lru_size; do
- D=$(dirname $F)
- log "Disable lru resize for $(basename $D)"
- DEFAULT_LRU_SIZE=$(default_lru_size)
- echo "$DEFAULT_LRU_SIZE" > $F
- done
+ lctl set_param ldlm.namespaces.*$1*.lru_size $(default_lru_size)
}
pgcache_empty() {
- for a in /proc/fs/lustre/llite/*/dump_page_cache; do
- if [ `wc -l $a | awk '{print $1}'` -gt 1 ]; then
- echo there is still data in page cache $a ?
- cat $a;
- return 1;
+ local FILE
+ for FILE in `lctl get_param -N "llite.*.dump_page_cache"`; do
+ if [ `lctl get_param -n $FILE | wc -l` -gt 1 ]; then
+ echo there is still data in page cache $FILE ?
+ lctl get_param -n $FILE
+ return 1
fi
done
return 0
}
check_mds() {
- FFREE=`cat /proc/fs/lustre/mds/*/filesfree`
- FTOTAL=`cat /proc/fs/lustre/mds/*/filestotal`
+ FFREE=`lctl get_param -n mds.*.filesfree`
+ FTOTAL=`lctl get_param -n mds.*.filestotal`
[ $FFREE -ge $FTOTAL ] && error "files free $FFREE > total $FTOTAL" || true
}
[ "$CHECK_GRANT" == "no" ] && return 0
testname=GCHECK_ONLY_${base}
- [ ${!testname}x == x ] && return 0
+ [ ${!testname}x == x ] && return 0
- echo -n "checking grant......"
+ echo -n "checking grant......"
cd $SAVE_PWD
# write some data to sync client lost_grant
rm -f $DIR1/${tfile}_check_grant_* 2>&1
dd if=/dev/zero of=$DIR1/${tfile}_check_grant_$i bs=4k \
count=1 > /dev/null 2>&1
done
- # sync all the data and make sure no pending data on server
- sync_clients
-
- #get client grant and server grant
- client_grant=0
- for d in ${LPROC}/osc/*/cur_grant_bytes; do
- client_grant=$((client_grant + `cat $d`))
- done
- server_grant=0
- for d in ${LPROC}/obdfilter/*/tot_granted; do
- server_grant=$((server_grant + `cat $d`))
- done
+ # sync all the data and make sure no pending data on server
+ sync_clients
+
+ #get client grant and server grant
+ client_grant=0
+ for d in `lctl get_param -n osc.*.cur_grant_bytes`; do
+ client_grant=$((client_grant + $d))
+ done
+ server_grant=0
+ for d in `lctl get_param -n obdfilter.*.tot_granted`; do
+ server_grant=$((server_grant + $d))
+ done
# cleanup the check_grant file
for i in `seq $OSTCOUNT`; do