瀏覽代碼

Set read ahead cache for better microSD read performance

Bob Mottram 6 年之前
父節點
當前提交
572076dffa
共有 1 個文件被更改,包括 15 次插入0 次删除
  1. 15
    0
      src/freedombone-utils-setup

+ 15
- 0
src/freedombone-utils-setup 查看文件

@@ -794,6 +794,18 @@ function install_shellcheck {
794 794
     apt-get -yq install shellcheck
795 795
 }
796 796
 
797
+function set_read_ahead {
798
+    # Setting this can significantly improve microSD read performance
799
+    read_ahead="$1"
800
+    if [ ! "$read_ahead" ]; then
801
+        read_ahead=4096
802
+    fi
803
+    if [ ! -f /sys/devices/virtual/bdi/179:0/read_ahead_kb ]; then
804
+        return
805
+    fi
806
+    echo -n "$read_ahead" > /sys/devices/virtual/bdi/179:0/read_ahead_kb
807
+}
808
+
797 809
 function setup_utils {
798 810
     read_config_param "PROJECT_REPO"
799 811
     write_config_param "PROJECT_REPO" "$PROJECT_REPO"
@@ -816,6 +828,9 @@ function setup_utils {
816 828
     function_check separate_tmp_filesystem
817 829
     separate_tmp_filesystem 150
818 830
 
831
+    function_check set_read_ahead
832
+    set_read_ahead 4096
833
+
819 834
     function_check proc_filesystem_settings
820 835
     proc_filesystem_settings
821 836