diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2011-05-14 00:07:45 +0800 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2011-05-14 00:07:45 +0800 |
commit | 0451a762d2ced82b15e56c9e36a7596a94b7c75d (patch) | |
tree | c2b73b331d93f1775dd24cb295f74d47b5acde41 | |
parent | 7d59bdacc5283f22ff7d863a9e0d5e205c352c41 (diff) | |
download | vyatta-cfg-0451a762d2ced82b15e56c9e36a7596a94b7c75d.tar.gz vyatta-cfg-0451a762d2ced82b15e56c9e36a7596a94b7c75d.zip |
raise max number of inodes for config tmpfs mount
-rwxr-xr-x | etc/init.d/vyatta-router | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/etc/init.d/vyatta-router b/etc/init.d/vyatta-router index c9b9786..87e96f7 100755 --- a/etc/init.d/vyatta-router +++ b/etc/init.d/vyatta-router @@ -188,8 +188,22 @@ mount_slash_config () start () { log_action_begin_msg "Mounting Vyatta Config" - mount -o nosuid,nodev,mode=775 -t tmpfs none ${vyatta_configdir} && \ - chgrp ${GROUP} ${vyatta_configdir} + # ensure the vyatta_configdir supports a large number of inodes since + # the config hierarchy is often inode-bound (instead of size). + # impose a minimum and then scale up dynamically with the actual size + # of the system memory. + local tmem=$(sed -n 's/^MemTotal: \+\([0-9]\+\) kB$/\1/p' /proc/meminfo) + local tpages + local max_inodes=300000 + if [ -n "$tmem" ]; then + (( tpages = tmem / 4 )) + if (( tpages > max_inodes )); then + (( max_inodes = tpages )) + fi + fi + local tmpfs_opts="nosuid,nodev,mode=775,nr_inodes=$max_inodes" + mount -o $tmpfs_opts -t tmpfs none ${vyatta_configdir} \ + && chgrp ${GROUP} ${vyatta_configdir} log_action_end_msg $? disabled bootfile || init_bootfile |