+test_56ra() {
+ [[ $MDS1_VERSION -gt $(version_code 2.12.58) ]] ||
+ skip "MDS < 2.12.58 doesn't return LSOM data"
+ local dir=$DIR/$tdir
+
+ [[ $OSC == "mdc" ]] && skip "DoM files" && return
+
+ setup_56 $dir $NUMFILES $NUMDIRS "-c 1"
+
+ cancel_lru_locks $OSC
+
+ local rpcs_before=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ local expected=12
+ local cmd="$LFS find -size 0 -type f -lazy $dir"
+ local nums=$($cmd | wc -l)
+
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
+
+ local rpcs_after=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ [ $rpcs_before -eq $rpcs_after ] ||
+ error "'$cmd' should not send glimpse RPCs to OST"
+ cmd="$LFS find -size 0 -type f $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
+ rpcs_after=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ echo "Before: $rpcs_before After: $rpcs_after $NUMFILES"
+ $LCTL get_param osc.*.stats
+ [ $rpcs_after -eq $((rpcs_before + 12)) ] ||
+ error "'$cmd' should send 12 glimpse RPCs to OST"
+
+ cancel_lru_locks $OSC
+ rpcs_before=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ expected=0
+ cmd="$LFS find ! -size 0 -type f -lazy $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
+ rpcs_after=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ $LCTL get_param mdc.*.stats
+ [ $rpcs_before -eq $rpcs_after ] ||
+ error "'$cmd' should not send glimpse RPCs to OST"
+ cmd="$LFS find ! -size 0 -type f $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
+ rpcs_after=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ echo "Before: $rpcs_before After: $rpcs_after $NUMFILES"
+ [ $rpcs_after -eq $((rpcs_before + 12)) ] ||
+ error "'$cmd' should send 12 glimpse RPCs to OST"
+
+ echo "test" > $dir/$tfile
+ echo "test2" > $dir/$tfile.2 && sync
+ cancel_lru_locks $OSC
+ rpcs_before=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ expected=1
+ cmd="$LFS find -size 5 -type f -lazy $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
+ rpcs_after=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ [ $rpcs_before -eq $rpcs_after ] ||
+ error "'$cmd' should not send glimpse RPCs to OST"
+ cmd="$LFS find -size 5 -type f $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
+ rpcs_after=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ echo "Before: $rpcs_before After: $rpcs_after $NUMFILES"
+ [ $rpcs_after -eq $((rpcs_before + 14)) ] ||
+ error "'$cmd' should send 14 glimpse RPCs to OST"
+
+ cancel_lru_locks $OSC
+ rpcs_before=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ expected=1
+ cmd="$LFS find -size +5 -type f -lazy $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
+ rpcs_after=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ [ $rpcs_before -eq $rpcs_after ] ||
+ error "'$cmd' should not send glimpse RPCs to OST"
+ cmd="$LFS find -size +5 -type f $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
+ rpcs_after=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ echo "Before: $rpcs_before After: $rpcs_after $NUMFILES"
+ [ $rpcs_after -eq $((rpcs_before + 14)) ] ||
+ error "'$cmd' should send 14 glimpse RPCs to OST"
+
+ cancel_lru_locks $OSC
+ rpcs_before=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ expected=2
+ cmd="$LFS find -size +0 -type f -lazy $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
+ rpcs_after=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ [ $rpcs_before -eq $rpcs_after ] ||
+ error "'$cmd' should not send glimpse RPCs to OST"
+ cmd="$LFS find -size +0 -type f $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
+ rpcs_after=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ echo "Before: $rpcs_before After: $rpcs_after $NUMFILES"
+ [ $rpcs_after -eq $((rpcs_before + 14)) ] ||
+ error "'$cmd' should send 14 glimpse RPCs to OST"
+
+ cancel_lru_locks $OSC
+ rpcs_before=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ expected=2
+ cmd="$LFS find ! -size -5 -type f -lazy $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
+ rpcs_after=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ [ $rpcs_before -eq $rpcs_after ] ||
+ error "'$cmd' should not send glimpse RPCs to OST"
+ cmd="$LFS find ! -size -5 -type f $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
+ rpcs_after=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ echo "Before: $rpcs_before After: $rpcs_after $NUMFILES"
+ [ $rpcs_after -eq $((rpcs_before + 14)) ] ||
+ error "'$cmd' should send 14 glimpse RPCs to OST"
+
+ cancel_lru_locks $OSC
+ rpcs_before=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ expected=12
+ cmd="$LFS find -size -5 -type f -lazy $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
+ rpcs_after=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ [ $rpcs_before -eq $rpcs_after ] ||
+ error "'$cmd' should not send glimpse RPCs to OST"
+ cmd="$LFS find -size -5 -type f $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
+ rpcs_after=$(calc_stats $OSC.*$OSC*.stats ldlm_glimpse_enqueue)
+ echo "Before: $rpcs_before After: $rpcs_after $NUMFILES"
+ [ $rpcs_after -eq $((rpcs_before + 14)) ] ||
+ error "'$cmd' should send 14 glimpse RPCs to OST"
+}
+run_test 56ra "check lfs find -size -lazy works for data on OSTs"
+
+test_56rb() {
+ local dir=$DIR/$tdir
+ local tmp=$TMP/$tfile.log
+ local mdt_idx;
+
+ test_mkdir -p $dir || error "failed to mkdir $dir"
+ $LFS setstripe -c 1 -i 0 $dir/$tfile ||
+ error "failed to setstripe $dir/$tfile"
+ dd if=/dev/zero of=$dir/$tfile bs=1M count=1
+
+ stack_trap "rm -f $tmp" EXIT
+ $LFS find --size +100K --ost 0 $dir 2>&1 | tee $tmp
+ [ -z "$(cat $tmp | grep "obd_uuid: ")" ] ||
+ error "failed to find --size +100K --ost 0 $dir"
+ $LFS find --size +100K --mdt $mdt_idx $dir 2>&1 | tee $tmp
+ [ -z "$(cat $tmp | grep "obd_uuid: ")" ] ||
+ error "failed to find --size +100K --mdt $mdt_idx $dir"
+}
+run_test 56rb "check lfs find --size --ost/--mdt works"
+