diff --git a/scripts/blockdev-perftest b/scripts/blockdev-perftest index 08e434ed9..65cdf3167 100755 --- a/scripts/blockdev-perftest +++ b/scripts/blockdev-perftest @@ -27,13 +27,14 @@ ######################### usage() { - echo "Usage: $0 [-a] [-d] [-i ] [-n] [-r] [-s ] " + echo "Usage: $0 [-a] [-d] [-i ] [-n] [-r] [-s ] [-t [user@]host] " echo " -a - use asynchronous (buffered) I/O." echo " -d - use direct (non-buffered) I/O." echo " -i - number times each test is iterated." echo " -n - do not verify the data on before overwriting it." echo " -r - only perform the read test." echo " -s - logarithm base two of the I/O size." + echo " -t - username and hostname of the target to drop the caches on." echo " - block device to run the I/O performance test on." } @@ -51,6 +52,9 @@ drop_caches() { if [ -w /proc/sys/vm/drop_caches ]; then echo 3 > /proc/sys/vm/drop_caches fi + if [ "${target_login}" != "" ]; then + ssh -n ${target_login} 'sync; if [ -w /proc/sys/vm/drop_caches ]; then echo 3 > /proc/sys/vm/drop_caches; fi' + fi } # Read times in seconds from stdin, one number per line, echo each number @@ -71,6 +75,7 @@ log2_min_blocksize=9 # 512 bytes log2_max_blocksize=26 # 64 MB iotype=direct read_test_only=false +target_login="" verify_device_data=true @@ -78,7 +83,7 @@ verify_device_data=true # Argument processing # ######################### -set -- $(/usr/bin/getopt "adhi:nrs:" "$@") +set -- $(/usr/bin/getopt "adhi:nrs:t:" "$@") while [ "$1" != "${1#-}" ] do case "$1" in @@ -88,6 +93,7 @@ do '-n') verify_device_data="false"; shift;; '-r') read_test_only="true"; shift;; '-s') log2_io_size="$2"; shift; shift;; + '-t') target_login="$2"; shift; shift;; '--') shift;; *) usage; exit 1;; esac @@ -123,7 +129,7 @@ then fi if [ "${iotype}" = "direct" ]; then - dd_oflags="oflag=direct" + dd_oflags="oflag=direct conv=notrunc" dd_iflags="iflag=direct" else dd_oflags="oflag=sync"