From 41357d98dd7ba5a17a5bf3e3e21d4050018a4966 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Mon, 18 Nov 2019 15:08:02 +0100 Subject: [slx-dmsetup] back to sparse files since preallocating the cow file did not work well with overprovisioned tmpfs --- builder/modules.d/slx-dmsetup/scripts/dmsetup-slx-device | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/builder/modules.d/slx-dmsetup/scripts/dmsetup-slx-device b/builder/modules.d/slx-dmsetup/scripts/dmsetup-slx-device index 5d5ec267..64b12047 100755 --- a/builder/modules.d/slx-dmsetup/scripts/dmsetup-slx-device +++ b/builder/modules.d/slx-dmsetup/scripts/dmsetup-slx-device @@ -153,15 +153,8 @@ ramdisk_fallback() { fi local file="$(mktemp -u -p "$cow_tmpfs" dnbd_cow.XXX)" - local fail_count=0 - while ! fallocate -l "${cow_size}K" "$file" ; do - (( cow_size -= 4 )) - if [ "$(( fail_count ++ ))" -eq 1000 ]; then - break - fi - done - if [ "$fail_count" -eq 1000 ]; then - emergency_shell "Failed to allocate CoW file $file after 1000 tries. :(" + if ! dd of="$file" seek="$cow_size" bs=1k count=0 &> /dev/null; then + emergency_shell "Failed to allocate CoW file $file." fi writable_device="$(losetup --show --find "$file")" cow_device_candidate="root" -- cgit v1.2.3-55-g7522