mirror of
https://github.com/Antynea/grub-btrfs.git
synced 2026-03-04 12:56:29 +08:00
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 <nephros@pearl.crownest.nephros.org>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user