+run_test 182a "Test parallel modify metadata operations from mdc"
+
+test_182b() {
+ [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+ local dcount=1000
+ local tcount=10
+ local stime
+ local etime
+ local delta
+
+ do_facet mds1 $LCTL list_param \
+ osp.$FSNAME-MDT*-osp-MDT*.rpc_stats ||
+ skip "MDS lacks parallel RPC handling"
+
+ $LFS mkdir -i 0 $DIR/$tdir || error "creating dir $DIR/$tdir"
+
+ rpc_count=$(do_facet mds1 $LCTL get_param -n \
+ osp.$FSNAME-MDT0001-osp-MDT0000.max_mod_rpcs_in_flight)
+
+ stime=$(date +%s)
+ createmany -i 0 -d $DIR/$tdir/t- $tcount
+
+ for (( i = 0; i < $tcount; i++ )) ; do
+ createmany -i 0 -d $DIR/$tdir/t-$i/d- 0 $dcount &
+ done
+ wait
+ etime=$(date +%s)
+ delta=$((etime - stime))
+ echo "Time for file creation $delta sec for $rpc_count parallel RPCs"
+
+ stime=$(date +%s)
+ for (( i = 0; i < $tcount; i++ )) ; do
+ unlinkmany -d $DIR/$tdir/$i/d- $dcount &
+ done
+ wait
+ etime=$(date +%s)
+ delta=$((etime - stime))
+ echo "Time for file removal $delta sec for $rpc_count parallel RPCs"
+
+ rm -rf $DIR/$tdir
+
+ $LFS mkdir -i 0 $DIR/$tdir || error "creating dir $DIR/$tdir"
+
+ do_facet mds1 $LCTL set_param osp.$FSNAME-MDT0001-osp-MDT0000.max_mod_rpcs_in_flight=1
+
+ stime=$(date +%s)
+ createmany -i 0 -d $DIR/$tdir/t- $tcount
+
+ for (( i = 0; i < $tcount; i++ )) ; do
+ createmany -i 0 -d $DIR/$tdir/t-$i/d- 0 $dcount &
+ done
+ wait
+ etime=$(date +%s)
+ delta=$((etime - stime))
+ echo "Time for file creation $delta sec for 1 RPC sent at a time"
+
+ stime=$(date +%s)
+ for (( i = 0; i < $tcount; i++ )) ; do
+ unlinkmany -d $DIR/$tdir/t-$i/d- $dcount &
+ done
+ wait
+ etime=$(date +%s)
+ delta=$((etime - stime))
+ echo "Time for file removal $delta sec for 1 RPC sent at a time"
+
+ do_facet mds1 $LCTL set_param osp.$FSNAME-MDT0001-osp-MDT0000.max_mod_rpcs_in_flight=$rpc_count
+}
+run_test 182b "Test parallel modify metadata operations from osp"