Comment # 20 on bug 950178 from
So I was able to reproduce by hacking btrfs-image' restore behaviour so that it
sets the target fs total size to match the used size:

diff --git a/btrfs-image.c b/btrfs-image.c
index 82eed05..1d44ea1 100644
--- a/btrfs-image.c
+++ b/btrfs-image.c
@@ -2386,6 +2386,7 @@ static int fixup_devices(struct btrfs_fs_info *fs_info,

        devid = btrfs_stack_device_id(dev_item);

+       dev_size = mdres->alloced_chunks;
        btrfs_set_stack_device_total_bytes(dev_item, dev_size);
        btrfs_set_stack_device_bytes_used(dev_item, mdres->alloced_chunks);


With that applied to btrfs-progs, I was able to reproduce your enospc issue.
After mounting the restored fs, the unused block groups were never deleted,
because the cleaner kthread always got a -ENOSPC error when trying to start a
transaction to delete unused block groups - the cleaner does not log such
errors nor takes any special action, whence why it was silent (nothing in
syslog/dmesg).

With the patch I attached earlier, soon after the mounting the fs the unused
block groups were deleted, and about 33Gb of space released.


You are receiving this mail because: