diff --git a/compacting-storage.lua b/compacting-storage.lua index 0c0e604..ccb983c 100644 --- a/compacting-storage.lua +++ b/compacting-storage.lua @@ -133,19 +133,18 @@ function should_fill (type, counts) end if fill_src ~= nil and fill_dest ~= nil then break end end - local amount_to_use = do - local ratio = AMOUNT_USED / AMOUNT_RETURNED - local amount_needed_src = nil - if fill_src == "block" then - amount_needed_src = amount_needed / ratio - else - amount_needed_src = amount_needed * ratio - end - if amount_needed_src < amount_spare then - return amount_needed_src - else - return amount_spare - end + local amount_to_use = nil + local ratio = AMOUNT_USED / AMOUNT_RETURNED + local amount_needed_src = nil + if fill_src == "block" then + amount_needed_src = amount_needed / ratio + else + amount_needed_src = amount_needed * ratio + end + if amount_needed_src < amount_spare then + amount_to_use = amount_needed_src + else + amount_to_use = amount_spare end return fill_dest, fill_src, amount_to_use end