1
0
Fork 0

set_disk_readahead -> multiply_disk_readahead

Resolves: #658843
This commit is contained in:
Jan Vcelak 2011-01-04 18:13:45 +01:00
parent 54b1caece5
commit 4e9b48112d
2 changed files with 12 additions and 6 deletions

View file

@ -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
}

View file

@ -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
}