+scrub_check_params() {
+ local error_id=$1
+ local expected=$2
+ local actual
+ local n
+
+ for n in $(seq $MDSCOUNT); do
+ actual=$(do_facet mds$n $LCTL get_param -n \
+ osd-ldiskfs.$(facet_svc mds$n).oi_scrub |
+ awk '/^param/ { print $2 }')
+ if [ "$actual" != "$expected" ]; then
+ error "($error_id) Expected '$expected' on mds$n, but" \
+ "got '$actual'"
+ fi
+ done
+}
+
+scrub_check_repaired() {
+ local error_id=$1
+ local expected=$2
+ local actual
+ local n
+
+ for n in $(seq $MDSCOUNT); do
+ actual=$(do_facet mds$n $LCTL get_param -n \
+ osd-ldiskfs.$(facet_svc mds$n).oi_scrub |
+ awk '/^updated/ { print $2 }')
+
+ if [ $expected -eq 0 -a $actual -ne 0 ]; then
+ error "($error_id) Expected no repaired on mds$n, but" \
+ "got '$actual'"
+ fi
+
+ if [ $expected -ne 0 -a $actual -lt $expected ]; then
+ error "($error_id) Expected '$expected' on mds$n, but" \
+ "got '$actual'"
+ fi
+ done
+}
+
+scrub_check_data() {
+ local error_id=$1
+ local n
+
+ for n in $(seq $MDSCOUNT); do
+ diff -q $LUSTRE/tests/test-framework.sh \
+ $DIR/$tdir/mds$n/test-framework.sh ||
+ error "($error_id) File data check failed"
+ done
+}
+
+scrub_check_data2() {
+ local filename=$1
+ local error_id=$2
+ local n
+
+ for n in $(seq $MDSCOUNT); do
+ diff -q $LUSTRE/tests/$filename \
+ $DIR/$tdir/mds$n/$filename ||
+ error "($error_id) File data check failed"
+ done
+}
+
+scrub_remove_ois() {
+ local error_id=$1
+ local index=$2
+ local n
+
+ for n in $(seq $MDSCOUNT); do
+ mds_remove_ois mds$n $index ||
+ error "($error_id) Failed to remove OI .$index on mds$n"
+ done
+}
+
+scrub_backup_restore() {
+ local error_id=$1
+ local igif=$2
+ local n
+
+ for n in $(seq $MDSCOUNT); do
+ mds_backup_restore mds$n $igif ||
+ error "($error_id) Backup/restore on mds$n failed"
+ done
+}
+
+scrub_enable_auto() {
+ do_nodes $(comma_list $(mdts_nodes)) $LCTL set_param -n \
+ osd-ldiskfs.*.auto_scrub=1
+}
+
+full_scrub_ratio() {
+ [[ $(lustre_version_code $SINGLEMDS) -le $(version_code 2.6.50) ]] &&
+ return
+
+ local ratio=$1
+
+ do_nodes $(comma_list $(mdts_nodes)) $LCTL set_param -n \
+ osd-ldiskfs.*.full_scrub_ratio=$ratio
+}
+
+full_scrub_threshold_rate() {
+ [[ $(lustre_version_code $SINGLEMDS) -le $(version_code 2.6.50) ]] &&
+ return