host: use fallocate to reclaim free space from cleared sectors
Host choses random index in siahostdata.dat file to put data. The file is created as a sparse file, which makes unused disk space available to other purposes. However when a sector is deleted, it still consumes disk space. If utilization of the storage is low, then new sectors are likely to be written to new locations, increasing the real size of the file.
For example, my host stores 1.1T of used data, but the size of siahostdata.dat reported by du -sh
is 1.3T. This can be a result of non-reusing old locations. If this is correct, the file will grow even if the amount of used data will not.
One solution is to keep track of such unused sectors and reuse them instead of writing to a random place. Another approach is to tell the kernel to deallocate the space when the sector is removed. The later can be done with fallocate syscall (draft).