From 6ff1fc7127a41abc0275cde532b6efb8e99df760 Mon Sep 17 00:00:00 2001 From: Peter Gantner Date: Fri, 17 Jul 2020 22:43:27 +0200 Subject: [PATCH] grub script: improve snapshot listing performance (#93) Btrfs filesystems may be slow when listing snapshots and calculating space usage for each. And that space information is not needed and never used in the scipt. So, add --disable-ununsed-space to all calls to btrfs. See: https://github.com/Antynea/grub-btrfs/issues/91 Co-authored-by: Peter G --- 41_snapshots-btrfs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/41_snapshots-btrfs b/41_snapshots-btrfs index e89bd59..10fd556 100755 --- a/41_snapshots-btrfs +++ b/41_snapshots-btrfs @@ -242,11 +242,11 @@ snapshot_list() if [ $? -eq 0 ]; then if [ -s "/etc/snapper/configs/$snapper_config" ]; then printf "# Info: snapper detected, using config '$snapper_config'\n" >&2 - local snapper_ids=($(snapper --no-dbus -t 0 -c "$snapper_config" list | tail -n +3 | cut -d'|' -f 1)) - local snapper_types=($(snapper --no-dbus -t 0 -c "$snapper_config" list | tail -n +3 | cut -d'|' -f 2)) + local snapper_ids=($(snapper --no-dbus -t 0 -c "$snapper_config" list --disable-used-space | tail -n +3 | cut -d'|' -f 1)) + local snapper_types=($(snapper --no-dbus -t 0 -c "$snapper_config" list --disable-used-space | tail -n +3 | cut -d'|' -f 2)) IFS=$'\n' - local snapper_descriptions=($(snapper --no-dbus -t 0 -c "$snapper_config" list | tail -n +3 | rev | cut -d'|' -f 2 | rev)) + local snapper_descriptions=($(snapper --no-dbus -t 0 -c "$snapper_config" list --disable-used-space | tail -n +3 | rev | cut -d'|' -f 2 | rev)) else printf "# Warning: snapper detected but config '$snapper_config' does not exist\n" >&2 fi