}
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
}
# 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}')
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