Set read ahead cache for better microSD read performance

This commit is contained in:
Bob Mottram 2018-04-21 12:56:58 +01:00
parent 66fa2a0ff8
commit 572076dffa
1 changed files with 15 additions and 0 deletions

View File

@ -794,6 +794,18 @@ function install_shellcheck {
apt-get -yq install shellcheck apt-get -yq install shellcheck
} }
function set_read_ahead {
# Setting this can significantly improve microSD read performance
read_ahead="$1"
if [ ! "$read_ahead" ]; then
read_ahead=4096
fi
if [ ! -f /sys/devices/virtual/bdi/179:0/read_ahead_kb ]; then
return
fi
echo -n "$read_ahead" > /sys/devices/virtual/bdi/179:0/read_ahead_kb
}
function setup_utils { function setup_utils {
read_config_param "PROJECT_REPO" read_config_param "PROJECT_REPO"
write_config_param "PROJECT_REPO" "$PROJECT_REPO" write_config_param "PROJECT_REPO" "$PROJECT_REPO"
@ -816,6 +828,9 @@ function setup_utils {
function_check separate_tmp_filesystem function_check separate_tmp_filesystem
separate_tmp_filesystem 150 separate_tmp_filesystem 150
function_check set_read_ahead
set_read_ahead 4096
function_check proc_filesystem_settings function_check proc_filesystem_settings
proc_filesystem_settings proc_filesystem_settings