diff --git a/tune-profiles/enterprise-storage/ktune.sh b/tune-profiles/enterprise-storage/ktune.sh index 3cc7527..9664537 100755 --- a/tune-profiles/enterprise-storage/ktune.sh +++ b/tune-profiles/enterprise-storage/ktune.sh @@ -14,7 +14,7 @@ start() { nobarriervols=$(echo "$volumes" | grep -v $rootvol | grep -v $bootvol) remount_partitions nobarrier $nobarriervols - set_disk_readahead 512 + multiply_disk_readahead 4 return 0 } @@ -31,7 +31,7 @@ stop() { nobarriervols=$(echo "$volumes" | grep -v $rootvol | grep -v $bootvol) remount_partitions barrier $nobarriervols - set_disk_readahead 128 + multiply_disk_readahead 0.25 return 0 } diff --git a/tune-profiles/functions b/tune-profiles/functions index 61fac45..d780c6f 100644 --- a/tune-profiles/functions +++ b/tune-profiles/functions @@ -42,13 +42,19 @@ set_disk_spindown() { done } -# usage: set_disk_readahead -set_disk_readahead() { - value=$1 +# usage: multiply_disk_readahead by +multiply_disk_readahead() { + by=$1 + + # float multiplication not supported in bash + # bc might not be installed, python is available for sure readaheadvols=$(ls /sys/block/{sd,cciss}*/queue/read_ahead_kb 2>/dev/null) for d in $readaheadvols; do - (echo $value > $d) &>/dev/null + old=$(cat $d) + new=$(echo "print int($old*$by)" | python) + + (echo $new > $d) &>/dev/null done }