genfio: Adding cached_based option
authorErwan Velu <erwan@enovance.com>
Wed, 10 Jul 2013 14:44:24 +0000 (16:44 +0200)
committerErwan Velu <erwan@enovance.com>
Fri, 12 Jul 2013 09:47:06 +0000 (11:47 +0200)
By default fio is still run in direct mode which is safer for many
benchmarking approach. In some case, you might need to enable the
cached-based IOs.

The "-c" option is now here for enabling this.

tools/genfio

index efc87a29514c72a48c54ff75baa1092c6c919e38..306d97e5b481288642947d61e39e72aa554b53ff 100755 (executable)
@@ -29,12 +29,15 @@ RUNTIME=300
 ETA=0
 MODES="read,write,randread,randwrite"
 SHORT_HOSTNAME=
+CACHED_IO="FALSE"
 
 show_help() {
        PROG=$(basename $0)
        echo "usage of $PROG:"
        cat << EOF
 -h                             : Show this help & exit
+-c                             : Enable cached-based IOs
+                                       by default, fio is run in direct mode
 -a                             : Run sequential test then parallel one
 -s                             : Run sequential test (default value)
                                        one test after another then one disk after another
@@ -78,7 +81,6 @@ cat >$TEMPLATE << EOF
 ioengine=libaio
 invalidate=1
 ramp_time=5
-direct=1
 EOF
 
 if [ "$RUNTIME" != "0" ]; then
@@ -87,6 +89,12 @@ runtime=$RUNTIME
 EOF
 fi
 
+if [ "$CACHED_IO" = "FALSE" ]; then
+cat >>$TEMPLATE << EOF
+direct=1
+EOF
+fi
+
 }
 
 gen_seq_suite() {
@@ -161,7 +169,7 @@ esac
 }
 
 parse_cmdline() {
-while getopts "hapsd:b:r:m:" opt; do
+while getopts "hacpsd:b:r:m:" opt; do
   case $opt in
     h)
        show_help
@@ -170,6 +178,9 @@ while getopts "hapsd:b:r:m:" opt; do
     b)
        BLOCK_SIZE=$OPTARG
        ;;
+    c)
+       CACHED_IO="TRUE"
+       ;;
     s)
        if [ "$SEQ" = "-1" ]; then
                SEQ=1