From 0c714cd55c3e9750c18f4f16b8b7b9163510978e Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Mon, 8 Oct 2018 23:31:50 -0400 Subject: [PATCH] scripts: use multiples (not power) of 128K Adjust the scripts for the new smaller hash table extent size. Signed-off-by: Zygo Blaxell --- scripts/beesd.conf.sample | 4 ++-- scripts/beesd.in | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/beesd.conf.sample b/scripts/beesd.conf.sample index 036540a..d7750d9 100644 --- a/scripts/beesd.conf.sample +++ b/scripts/beesd.conf.sample @@ -30,5 +30,5 @@ UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx # 1TB 16MB 1024K # 64TB 1GB 1024K # -# Size MUST be power of 16M -# DB_SIZE=$((64*$AL16M)) # 1G in bytes +# Size MUST be multiple of 128KB +# DB_SIZE=$((8192*$AL128K)) # 1G in bytes diff --git a/scripts/beesd.in b/scripts/beesd.in index 7b9f82d..b5d6564 100755 --- a/scripts/beesd.in +++ b/scripts/beesd.in @@ -9,9 +9,9 @@ YN(){ [[ "$1" =~ (1|Y|y) ]]; } export BEESHOME BEESSTATUS export WORK_DIR CONFIG_DIR export CONFIG_FILE -export UUID AL16M +export UUID AL128K -readonly AL16M="$((16*1024*1024))" +readonly AL128K="$((128*1024))" readonly CONFIG_DIR=@ETC_PREFIX@/bees/ readonly bees_bin=$(realpath @LIBEXEC_PREFIX@/bees) @@ -89,7 +89,7 @@ WORK_DIR="${WORK_DIR:-/run/bees/}" MNT_DIR="${MNT_DIR:-$WORK_DIR/mnt/$UUID}" BEESHOME="${BEESHOME:-$MNT_DIR/.beeshome}" BEESSTATUS="${BEESSTATUS:-$WORK_DIR/$UUID.status}" -DB_SIZE="${DB_SIZE:-$((64*AL16M))}" +DB_SIZE="${DB_SIZE:-$((8192*AL128K))}" INFO "Check: Disk exists" if [ ! -b "/dev/disk/by-uuid/$UUID" ]; then @@ -128,8 +128,8 @@ fi touch "$DB_PATH" OLD_SIZE="$(du -b "$DB_PATH" | sed 's/\t/ /g' | cut -d' ' -f1)" NEW_SIZE="$DB_SIZE" - if (( "$NEW_SIZE"%AL16M > 0 )); then - ERRO "DB_SIZE Must be multiple of 16M" + if (( "$NEW_SIZE"%AL128K > 0 )); then + ERRO "DB_SIZE Must be multiple of 128K" fi if (( "$OLD_SIZE" != "$NEW_SIZE" )); then INFO "Resize db: $OLD_SIZE -> $NEW_SIZE"