local pages=${3:-64}
local rc=0
local id
+
+ local count=10
+ local obd_size=$(get_obd_size $node $OBD)
+ local page_size=$(get_page_size $node)
+ if [[ -n "$obd_size" ]]; then
+ local new_count=$((obd_size / (pages * page_size / 1024)))
+ [[ $new_count -ge $count ]] || count=$new_count
+ fi
+
do_facet $node "$LCTL attach echo_client ec ec_uuid" || rc=1
[ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec setup $OBD" ||
rc=2; }
[ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec getattr $id" ||
rc=4; }
[ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec " \
- "test_brw 10 w v $pages $id" || rc=4; }
+ "test_brw $count w v $pages $id" || rc=4; }
[ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec destroy $id 1" ||
rc=4; }
[ $rc -eq 0 -o $rc -gt 2 ] && { do_facet $node "$LCTL --device ec " \
$LCTL get_param -n osc.*.kbytesavail | sort -n | head -n1
}
+#
+# Get the available size (KB) of a given obd target.
+#
+get_obd_size() {
+ local facet=$1
+ local obd=$2
+ local size
+
+ [[ $facet != client ]] || return 0
+
+ size=$(do_facet $facet $LCTL get_param -n *.$obd.kbytesavail | head -n1)
+ echo -n $size
+}
+
+#
+# Get the page size (bytes) on a given facet node.
+#
+get_page_size() {
+ local facet=$1
+ local size
+
+ size=$(do_facet $facet getconf PAGE_SIZE)
+ [[ ${PIPESTATUS[0]} = 0 && -n "$size" ]] || size=4096
+ echo -n $size
+}
+
# Get the block size of the filesystem.
get_block_size() {
local facet=$1