Whamcloud - gitweb
LU-657 test: limit the write size in run_dd
authorHongchao Zhang <hongchao.zhang@whamcloud.com>
Mon, 31 Dec 2012 19:32:25 +0000 (03:32 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 10 Jan 2013 15:28:23 +0000 (10:28 -0500)
1, in run_dd.sh, limit the write size of dd according to
   the free disk space currently intead of using fixed value.

2, fix a bug in ofd_tnx_stop_cb, which cleared the 'thandle->th_sync'

Test-Parameters: envdefinitions=SLOW=yes clientcount=4 osscount=2 mdscount=2 austeroptions=-R failover=true useiscsi=true testlist=recovery-mds-scale
Signed-off-by: Hongchao Zhang <hongchao.zhang@whamcloud.com>
Change-Id: I8b9cc2fc8b9831e5ad79b521ba7af4ae9160143f
Reviewed-on: http://review.whamcloud.com/4599
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/ofd/ofd_trans.c
lustre/tests/run_dd.sh
lustre/tests/test-framework.sh

index 390a5e1..3112a50 100644 (file)
@@ -244,9 +244,9 @@ int ofd_txn_stop_cb(const struct lu_env *env, struct thandle *txn,
               info->fti_transno, ofd_obd(ofd)->obd_last_committed);
 
        /* if can't add callback, do sync write */
-       txn->th_sync = !!tgt_last_commit_cb_add(txn, &ofd->ofd_lut,
-                                               info->fti_exp,
-                                               info->fti_transno);
+       txn->th_sync |= !!tgt_last_commit_cb_add(txn, &ofd->ofd_lut,
+                                                info->fti_exp,
+                                                info->fti_transno);
 
        return ofd_last_rcvd_update(info, txn);
 }
index 36af6ae..6106bb0 100755 (executable)
@@ -17,7 +17,7 @@ set -x
 
 . $(dirname $0)/functions.sh
 
-assert_env MOUNT END_RUN_FILE LOAD_PID_FILE
+assert_env MOUNT END_RUN_FILE LOAD_PID_FILE LFS
 
 trap signaled TERM
 
@@ -28,30 +28,36 @@ TESTDIR=$MOUNT/d0.dd-$(hostname)
 
 CONTINUE=true
 while [ ! -e "$END_RUN_FILE" ] && $CONTINUE; do
-    echoerr "$(date +'%F %H:%M:%S'): dd run starting"
-    mkdir -p $TESTDIR
-    cd $TESTDIR
-    # suppress dd xfer stat to workaround buggy coreutils/gettext
-    # combination in RHEL5 and OEL5, see BZ 21264
-    dd bs=4k count=1000000 status=noxfer if=/dev/zero of=$TESTDIR/dd-file 1>$LOG &
-    load_pid=$!
-    wait $load_pid
-
-    if [ $? -eq 0 ]; then
-        echoerr "$(date +'%F %H:%M:%S'): dd succeeded"
-        cd $TMP
-        rm -rf $TESTDIR
-        echoerr "$(date +'%F %H:%M:%S'): dd run finished"
-    else
-        echoerr "$(date +'%F %H:%M:%S'): dd failed"
-        if [ -z "$ERRORS_OK" ]; then
-            echo $(hostname) >> $END_RUN_FILE
-        fi
-        if [ $BREAK_ON_ERROR ]; then
-            # break
-            CONTINUE=false
-        fi
-    fi
+       echoerr "$(date +'%F %H:%M:%S'): dd run starting"
+       mkdir -p $TESTDIR
+       $LFS setstripe -c -1 $TESTDIR
+       cd $TESTDIR
+       # suppress dd xfer stat to workaround buggy coreutils/gettext
+       # combination in RHEL5 and OEL5, see BZ 21264
+       FREE_SPACE=$($LFS df $TESTDIR|awk '/filesystem summary:/ {print $5}')
+       BLKS=$((FREE_SPACE * 9 / 40))
+       echo "Free disk space is $FREE_SPACE, 4k blocks to dd is $BLKS"
+
+       dd bs=4k count=$BLKS status=noxfer if=/dev/zero of=$TESTDIR/dd-file \
+                                                               1>$LOG &
+       load_pid=$!
+       wait $load_pid
+
+       if [ $? -eq 0 ]; then
+               echoerr "$(date +'%F %H:%M:%S'): dd succeeded"
+               cd $TMP
+               rm -rf $TESTDIR
+               echoerr "$(date +'%F %H:%M:%S'): dd run finished"
+       else
+               echoerr "$(date +'%F %H:%M:%S'): dd failed"
+               if [ -z "$ERRORS_OK" ]; then
+                       echo $(hostname) >> $END_RUN_FILE
+               fi
+               if [ $BREAK_ON_ERROR ]; then
+                       # break
+                       CONTINUE=false
+               fi
+       fi
 done
 
 echoerr "$(date +'%F %H:%M:%S'): dd run exiting"
index 2fa0007..41bdd07 100644 (file)
@@ -1531,6 +1531,7 @@ TESTLOG_PREFIX=$TESTLOG_PREFIX \
 TESTNAME=$TESTNAME \
 DBENCH_LIB=$DBENCH_LIB \
 DBENCH_SRC=$DBENCH_SRC \
+LFS=$LFS \
 run_${load}.sh" &
     local ppid=$!
     log "Started client load: ${load} on $client"