-
-
Notifications
You must be signed in to change notification settings - Fork 976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
partsfile is not deleted upon finishing downloading #1967
Comments
The part file doesn't shrink when data from it is "evicted", nor is it removed if every part is removed from it. This is what you're referring to, right? I suppose the last part would be fairly simple to implement, just deleting the file whenever there's nothing it it. |
Yes, exactly. It also would be nice to shrink it when pieces get moved from it to the final files. On LInux a naïve implementation would simply call |
That would probably be a pretty simple patch. do you want to give it a stab? it conditioned on |
I can try. But why inside of the loop but not at the end of the function (via a RAI object, declared here, at the beginning of the function) in order to free all the blocks at once? |
because the mutex is released in the middle of that function. when the mutex is acquired again at the end, we do the lookup again. If we can't find the piece, another thread may already have punched a hold in the file and then re-allocated that space for some other piece. In fact, it also opens up the question of whether it's really OK to punch a hole while another thread is still reading from that portion (probably not) and that perhaps that need to be dealt with. perhaps a per-piece lock bit or something. not sure. |
I see. It's more complicated than trivial, then :) "Another reading thread" is a thread which uploads this peace to a remote peer? |
yeah, disk I/O is done in multiple threads, and holding a mutex during the actual disk access would defeat the purpose of multi-threaded I/O. The race condition I point out exists today though. punching a hole will just increase the chance a bit of getting into problems a bit. I'm not sure what the simplest way forward would be. perhaps to ignore the race for now and deal with it separately. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
libtorrent 1.1.3
Linux x64
GCC 6.3.0
Using qBittorrent master:
du -s <torrent dir> <parts file>
is almost equal to the torrent full size.Now final dir size is equal to the torrent size, but .parts file size did not change, so
du -s <torrent dir> <parts file>
is significantly greater than the torrent size.The text was updated successfully, but these errors were encountered: