ITADN

Thin provisioning support

#339Openedubart 创建于 2025-11-06
enhancement
E
edubartcommented
## Context Some dapps frequently add and remove data from their flash drives. Over time, an active dapp using an on-disk database may consume increasing amounts of drive space on the host without reclaiming free space. This adds unnecessary storage costs for node runners validating the dapp. This problem can be remediated using [thin provisioning](https://en.wikipedia.org/wiki/Thin_provisioning). With a proper solution, we could allow machines to start with 1TB of preallocated disk space where the actual used space on the host remains minimal, by leveraging sparse files. The hash tree would remain fast by avoiding pristine data access. ## Possible Solutions The solution requires: 1. **Guest kernel patch**: Add support for requesting the host emulator to discard unused disk space (using HTIF device) 2. **Guest filesystem**: Mount guest ext4 flash drives with the `discard` option 3. **Host HTIF device**: Handle HTIF request and use hole punching to reclaim space on the host 4. **Hash tree optimization**: Ensure the hash tree avoids touching pristine data in memory ranges (e.g., when preallocating a 1TB flash drive) We should also consider extending this approach to RAM. For machines with 1TB of RAM booted with `init_on_alloc=1 init_on_free=1`, which zeros allocated/deallocated pages when starting/terminating Linux processes, we could potentially reclaim physical memory as well.
0 条评论