From 572076dffa0522b80387fb9978d97dbd68409df5 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 21 Apr 2018 12:56:58 +0100 Subject: [PATCH] Set read ahead cache for better microSD read performance --- src/freedombone-utils-setup | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/freedombone-utils-setup b/src/freedombone-utils-setup index af83ae27..64f66d6a 100755 --- a/src/freedombone-utils-setup +++ b/src/freedombone-utils-setup @@ -794,6 +794,18 @@ function 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 { read_config_param "PROJECT_REPO" write_config_param "PROJECT_REPO" "$PROJECT_REPO" @@ -816,6 +828,9 @@ function setup_utils { function_check separate_tmp_filesystem separate_tmp_filesystem 150 + function_check set_read_ahead + set_read_ahead 4096 + function_check proc_filesystem_settings proc_filesystem_settings