Whamcloud - gitweb
Branch HEAD
authorhuanghua <huanghua>
Wed, 11 Feb 2009 02:33:23 +0000 (02:33 +0000)
committerhuanghua <huanghua>
Wed, 11 Feb 2009 02:33:23 +0000 (02:33 +0000)
b=17158
i=grev
i=rahul.deshmukh

exhaust_precreations fn for CMD - using get_mds_dir

lustre/tests/sanity.sh
lustre/tests/test-framework.sh

index 69e3833..eb4ade8 100644 (file)
@@ -937,21 +937,28 @@ reset_enospc() {
 }
 
 exhaust_precreations() {
-       OSTIDX=$1
+       local OSTIDX=$1
+       local MDSIDX=$(get_mds_dir "$DIR/d27")
+       echo OSTIDX=$OSTIDX MDSIDX=$MDSIDX
+
+       local OST=$(lfs osts | grep ${OSTIDX}": " | awk '{print $2}' | sed -e 's/_UUID$//')
+       local MDT_INDEX=$(lfs df | grep "\[MDT:$((MDSIDX - 1))\]" | awk '{print $1}' | \
+                         sed -e 's/_UUID$//;s/^.*-//')
 
-       OST=$(lfs osts | grep ${OSTIDX}": " | \
-           awk '{print $2}' | sed -e 's/_UUID$//')
        # on the mdt's osc
-       last_id=$(do_facet $SINGLEMDS lctl get_param -n osc.*${OST}-osc-MDT0000.prealloc_last_id)
-       next_id=$(do_facet $SINGLEMDS lctl get_param -n osc.*${OST}-osc-MDT0000.prealloc_next_id)
+       local last_id=$(do_facet mds${MDSIDX} lctl get_param -n osc.*${OST}-osc-${MDT_INDEX}.prealloc_last_id)
+       local next_id=$(do_facet mds${MDSIDX} lctl get_param -n osc.*${OST}-osc-${MDT_INDEX}.prealloc_next_id)
+
+       echo ${OST}-osc-${MDT_INDEX}.prealloc_last_id=$last_id
+       echo ${OST}-osc-${MDT_INDEX}.prealloc_next_id=$next_id
 
-       mkdir -p $DIR/d27/${OST}
-       $SETSTRIPE $DIR/d27/${OST} -i $OSTIDX -c 1
+       mkdir -p $DIR/d27
+       $SETSTRIPE $DIR/d27 -i $OSTIDX -c 1
 #define OBD_FAIL_OST_ENOSPC              0x215
        do_facet ost$((OSTIDX + 1)) lctl set_param fail_loc=0x215
        echo "Creating to objid $last_id on ost $OST..."
-       createmany -o $DIR/d27/${OST}/f $next_id $((last_id - next_id + 2))
-       do_facet $SINGLEMDS lctl get_param -n osc.*${OST}-osc-MDT0000.prealloc* | grep '[0-9]'
+       createmany -o $DIR/d27/${OST}-f $next_id $((last_id - next_id + 2))
+       do_facet mds${MDSIDX} lctl get_param osc.*${OST}-osc-${MDT_INDEX}.prealloc* | grep '[0-9]'
        reset_enospc $2
 }
 
index 07430ff..5da512a 100644 (file)
@@ -2349,7 +2349,7 @@ get_stripe_info() {
 # CMD: determine mds index where directory inode presents
 get_mds_dir () {
     local dir=$1
-    local file=$dir/$tfile
+    local file=$dir/f0.get_mds_dir_tmpfile
 
     rm -f $file
     local iused=$(lfs df -i $dir | grep MDT | awk '{print $3}')
@@ -2364,7 +2364,7 @@ get_mds_dir () {
     for ((i=0; i<${#newused[@]}; i++)); do
          if [ ${oldused[$i]} -lt ${newused[$i]} ];  then
              echo $(( i + 1 ))
-             rm -f $dir/$tfile
+             rm -f $file
              return 0
          fi
     done