local ost_dev
ost_name=$(ostname_from_index $obdidx)
- ost_dev=$(do_node $node "lctl get_param -n obdfilter.${ost_name}.mntdev")
- [ ${PIPESTATUS[0]} -ne 0 ] && \
- echo "failed to find the OST device with index $obdidx on $facet" && \
+ ost_dev=$(get_obdfilter_param $node $ost_name mntdev)
+ if [ $? -ne 0 ]; then
+ printf "unable to find OST%04x on $facet\n" $obdidx
return 1
+ fi
if [[ $ost_dev = *loop* ]]; then
- ost_dev=$(do_node $node "losetup $ost_dev" | \
+ ost_dev=$(do_node $node "losetup $ost_dev" |
sed -e "s/.*(//" -e "s/).*//")
fi
STRIPE_COUNT=$OSTCOUNT
STRIPE_OFFSET=0
- $LCTL set_param -n obdfilter.*.read_cache_enable=0
- $LCTL set_param -n obdfilter.*.writethrough_cache_enable=0
+ local list=$(comma_list $(osts_nodes))
+ set_obdfilter_param $list '' read_cache_enable 0
+ set_obdfilter_param $list '' writethrough_cache_enable 0
+
trap cleanup_test101bc EXIT
# prepare the read-ahead file
$SETSTRIPE $DIR/$tfile -s $STRIPE_SIZE -i $STRIPE_OFFSET -c $OSTCOUNT
trap 0
rm -rf $DIR/$tdir
rm -f $DIR/$tfile
- $LCTL set_param -n obdfilter.*.read_cache_enable=1
- $LCTL set_param -n obdfilter.*.writethrough_cache_enable=1
+
+ local list=$(comma_list $(osts_nodes))
+ set_obdfilter_param $list '' read_cache_enable 1
+ set_obdfilter_param $list '' writethrough_cache_enable 1
}
calc_total() {
function roc_hit() {
local list=$(comma_list $(osts_nodes))
- ACCNUM=$(do_nodes $list $LCTL get_param -n obdfilter.*.stats | \
+ echo $(get_obdfilter_param $list '' stats |
awk '/'cache_hit'/ {sum+=$2} END {print sum}')
- echo $ACCNUM
}
function set_cache() {
on=0;
fi
local list=$(comma_list $(osts_nodes))
- do_nodes $list lctl set_param obdfilter.*.${1}_cache_enable $on
+ set_obdfilter_param $list '' $1_cache_enable $on
cancel_lru_locks osc
}
local CPAGES=3
# check whether obdfilter is cache capable at all
- if ! do_nodes $list $LCTL get_param -n obdfilter.*.read_cache_enable > /dev/null; then
+ if ! get_obdfilter_param $list '' read_cache_enable >/dev/null; then
echo "not cache-capable obdfilter"
return 0
fi
# make sure cache is enabled on all obdfilters
- do_nodes $list $LCTL set_param obdfilter.*.read_cache_enable=1
- do_nodes $list $LCTL set_param obdfilter.*.writethrough_cache_enable=1
+ set_obdfilter_param $list '' read_cache_enable 1
+ set_obdfilter_param $list '' writethrough_cache_enable 1
# pages should be in the case right after write
dd if=/dev/urandom of=$DIR/$tfile bs=4k count=$CPAGES || error "dd failed"
# the following read invalidates the cache
cancel_lru_locks osc
- do_nodes $list $LCTL set_param -n obdfilter.*.read_cache_enable 0
+ set_obdfilter_param $list '' read_cache_enable 0
cat $DIR/$tfile >/dev/null
# now data shouldn't be found in the cache
error "IN CACHE: before: $BEFORE, after: $AFTER"
fi
- do_nodes $list $LCTL set_param -n obdfilter.*.read_cache_enable=1
- do_nodes $list $LCTL set_param obdfilter.*.writethrough_cache_enable=1
+ set_obdfilter_param $list '' read_cache_enable 1
+ set_obdfilter_param $list '' writethrough_cache_enable 1
rm -f $DIR/$tfile
}
run_test 151 "test cache on oss and controls ==============================="
return 0
}
+#
+# This and set_obdfilter_param() shall be used to access OBDFilter parameters
+# moved to OSD in 2.3, 2.4, or later server versions.
+#
+# mntdev
+# stats
+# read_cache_enable
+# writethrough_cache_enable
+#
+get_obdfilter_param() {
+ local nodes=$1
+ local device=${2:-$FSNAME-OST*}
+ local name=$3
+
+ do_nodes $nodes "$LCTL get_param -n obdfilter.$device.$name \
+ osd-*.$device.$name 2>&1" | grep -v 'Found no match'
+}
+
+set_obdfilter_param() {
+ local nodes=$1
+ local device=${2:-$FSNAME-OST*}
+ local name=$3
+ local value=$4
+
+ do_nodes $nodes "$LCTL set_param -n obdfilter.$device.$name=$value \
+ osd-*.$device.$name=$value 2>&1" | grep -v 'Found no match'
+}
+
set_debug_size () {
local dz=${1:-$DEBUG_SIZE}
local cpus=$(getconf _NPROCESSORS_CONF)
get_mnt_devs() {
local node=$1
local type=$2
- local obd_type
local devs
local dev
- case $type in
- mdt) obd_type="osd" ;;
- ost) obd_type="obdfilter" ;; # needs to be fixed when OST also uses an OSD
- *) echo "invalid server type" && return 1 ;;
- esac
-
- devs=$(do_node $node "lctl get_param -n $obd_type.*.mntdev")
+ if [ "$type" == ost ]; then
+ devs=$(get_obdfilter_param $node "" mntdev)
+ else
+ devs=$(do_node $node \
+ "lctl get_param -n osd-*.$FSNAME-M*.mntdev")
+ fi
for dev in $devs; do
case $dev in
*loop*) do_node $node "losetup $dev" | \