moros icon indicating copy to clipboard operation
moros copied to clipboard

Fix block bitmap area calculation

Open vinc opened this issue 1 year ago • 5 comments

The formula used to calculate the size of the block bitmap area was not correct, resulting in blocks that cannot be allocated. This issue surfaced after #637 when using about half of the disk.

One thing to note is that this PR will likely extend the size of the block bitmap area by one or more blocks so we must increase the version number of MFS to use the old formula on existing disks.

vinc avatar Jun 06 '24 16:06 vinc

This PR also fixes out of space errors when we used the whole disk.

vinc avatar Jun 06 '24 17:06 vinc

And now when we are out of disk we get the correct numbers:

~
> disk usage
size: 8376320
used: 8376320
free:       0

The system doesn't crash, there's just no writes to disk possible.

vinc avatar Jun 06 '24 19:06 vinc

To test the disk I generated a number of files with precise sizes on the host like this 100 KB file:

$ dd if=/dev/zero of=100 bs=1024 count=100

Then I launched a HTTP server in the dir on the host:

$ python -m http.server

And I downloaded the file from MOROS:

> time http 10.0.2.2:8000/100 => 1

vinc avatar Jun 06 '24 19:06 vinc

disk-4

vinc avatar Jun 07 '24 08:06 vinc

This is a breaking change that is very close to the summer solstice release date of MOROS so we'll merge it after the release to have 3 months to test it before the next.

vinc avatar Jun 16 '24 08:06 vinc