megatools icon indicating copy to clipboard operation
megatools copied to clipboard

(posix_)fallocate where possible and sane

Open RealDolos opened this issue 6 years ago • 2 comments

Telling the file system how big a file will be enables it to better place files on disk, avoid fragmentation, etc. *nix have a mechanism to effectively reserve a file of a certain size in the posix_fallocate or linux specific fallocate APIs. New file system will allocate a file almost instantly. However, "old" file systems like ext3 will actually write zeros, but who still uses ext3, r-right?! Windows has no equivalent API...

RealDolos avatar Sep 29 '18 08:09 RealDolos

Sadly, this would throw off the resume logic, which depends on the size of a file to determine how much data was already downloaded and where to resume after user cancels and restarts the process.

Megous avatar Sep 29 '18 11:09 Megous

Oh right, I remember disabling resume for that reason... still would be nice to have, tho that would mean tracking resume information explicitly some place else.

RealDolos avatar Sep 29 '18 11:09 RealDolos