Open palainp opened 3 years ago
I think you are mostly right because ocaml-fat
is very old, we currently on some others stuffs but we will come back to you with a solution :+1:.
FWIW since mirage-block-solo5.0.8.1 it is possible to write multiple sectors in one write https://github.com/mirage/mirage-block-solo5/pull/28. Solo5 still only supports writing one sector, but mirage-block-solo5 now hides that fact. It's still the case that mirage-block-xen can only write a single 4096 byte page.
The mirage-block-solo5 only accepts reading and writing one block at a time in https://github.com/Solo5/solo5/blob/0eb8cb8f57943e7872a94e19695911a1e0b8aef6/bindings/hvt/block.c#L39-L42. In https://github.com/mirage/ocaml-fat/blob/9171848e47a57a4b2bc1a72386abc82779876ae4/src/fat.ml#L134-L136, we ask to read 8 blocks of 512 bytes which fail when running with hvt as target.
The mirage-block-xen only accepts to read and write 1 page at a time in https://github.com/mirage/mirage-block-xen/blob/cf6d97c1f48a73baeedc57136028191db36d892f/lib/front/blkfront.ml#L461. In https://github.com/mirage/ocaml-fat/blob/9171848e47a57a4b2bc1a72386abc82779876ae4/src/fat.ml#L96-L104, it reads a bytes_per_sector bytes (with a default value of 512 bytes) which raises the Buffer_not_exactly_one_page exception.
I tested changing the page allocation from
4096
to512
and frombps
to4096
respectively in https://github.com/palainp/ocaml-fat. Now this works with my small tests, I have a "Test Successful" when I run thedune test
bench, but, as I don't have a clear vision of what could be impacted, it may trigger new bugs elsewhere. Does anyone have any idea what these changes may entail?