File allocation problem when doing selective download

Ask for help and report issues with the Windows version of Transmission
Post Reply
kIssGlaY
Posts: 24
Joined: Sat Jun 29, 2013 11:13 am

File allocation problem when doing selective download

Post by kIssGlaY »

Assume the torrent contain file: 1, 2, 3, 4.
If only download file 3, and pieces cross boundary of file 3 to file 2 and 4, then the file 2 will be fully allocated rather then a sparse file, but the file 4 as a single piece. Maybe this's because the block getting allocated is at the end of file 2 but header of file 4. But if the file 2 is large enough, like above 20G, transmission would freeze for a long time until the file is fully allocated.
Donno if it's a bug or not.
Last edited by kIssGlaY on Tue Apr 05, 2016 5:01 am, edited 1 time in total.
kIssGlaY
Posts: 24
Joined: Sat Jun 29, 2013 11:13 am

Re: File allocation problem when doing selective download

Post by kIssGlaY »

"preallocation" is set to 1.
Only the unselected file right before the selected one will be fully allocated rather than a sparse, all other files(the selected ones) are allocated as expected as sparse.
So if want to get rid of the client freeze for this situation, the workaround is: if want to download only file 3 from 1, 2, 3, 4, you should select 1, 2, 3 and start, wait for 1, 2, 3 to be created (as sparse of course), and then deselect 1 and 2.
Maybe this is the same behavior as on other platforms.
mike.dld
Transmission Developer
Posts: 306
Joined: Wed Dec 25, 2013 10:56 pm

Re: File allocation problem when doing selective download

Post by mike.dld »

I'll need to take a look later. Theoretically, there should be no difference in how files are deselected and space should be allocated sparsely or in full depending on preallocation setting. For now, the question is how do you check that space for file was allocated in full? File properties dialog I presume (which has "Size:" and "Size on disk:" fields)?
kIssGlaY
Posts: 24
Joined: Sat Jun 29, 2013 11:13 am

Re: File allocation problem when doing selective download

Post by kIssGlaY »

mike.dld wrote:I'll need to take a look later. Theoretically, there should be no difference in how files are deselected and space should be allocated sparsely or in full depending on preallocation setting. For now, the question is how do you check that space for file was allocated in full? File properties dialog I presume (which has "Size:" and "Size on disk:" fields)?
Yes, this is one thing I checked, the "Size on disk" of that ".part" file is equal to the actual size of the file.
What's more important is the client hang/freeze (remote client and webui have no response, no uploading / downloading) writing this file and from system monitor tool, observed the disk activity is all of writing that file at full rate of the hard disk, and once done writing, remote client and webui is back to normal. This is exactly the same behavior as doing a full preallocation (preallocation set to 2). For example, an unselected file of 30G would freeze the client for approx. 10 minutes.
BTW, the unofficial transmission-qt also got this issue.
x190 wrote:@mike.dld: Care to comment here? Even though, afaik, OS X doesn't do sparse files, the before and after behavior is the same, although not the rest of what kIssGlaY seems to be saying.
The unselected file right after the selected one is also NOT a sparse file, but the size of this file(for both "size" and "size on disk") is only of the size of the piece block (couple MiB or KiB).
But as for the unselected file right before the selected one, it is the size of the whole file, not just of the piece block.
kIssGlaY
Posts: 24
Joined: Sat Jun 29, 2013 11:13 am

Re: File allocation problem when doing selective download

Post by kIssGlaY »

The freeze of the client when writing these files is exactly as same as on the cygwin build of transmission daemon. Cygwin build doesn't support sparse file at all, so every single file created freeze the webui and remote client, and the time of freezing depends on file size, and this's a known issue on these builds.

The official build only freeze under situation I mentioned, and these files are definitely non-sparse. Because the block to be written is exactly the at the end of the unselected file, not middle or anywhere else, maybe windows does this ignoring the flag, if there's really no neglect in programming itself.
cfpp2p
Posts: 290
Joined: Sat Aug 08, 2009 3:14 pm

Re: File allocation problem when doing selective download

Post by cfpp2p »

Cygwin build doesn't support sparse file at all, so every single file created freeze the webui and remote client, and the time of freezing depends on file size, and this's a known issue on these builds.
There is a way of patching a cygwin transmission build and that patching, combined with patch of https://trac.transmissionbt.com/ticket/532, such that with a transmission cygwin build the freeze can be minimized to practically nil for most torrents.
mike.dld
Transmission Developer
Posts: 306
Joined: Wed Dec 25, 2013 10:56 pm

Re: File allocation problem when doing selective download

Post by mike.dld »

inout.c, line ~93:

Code: Select all

          const int prealloc = file->dnd || !doWrite
                             ? TR_PREALLOCATE_NONE
                             : tor->session->preallocationMode;
The logic traces back to the very introduction of preallocation in r7051...
mike.dld
Transmission Developer
Posts: 306
Joined: Wed Dec 25, 2013 10:56 pm

Re: File allocation problem when doing selective download

Post by mike.dld »

I was pointing to the fact that DND files aren't created as sparse in the first place. IIUC, FSCTL_SET_ZERO_DATA is to be used when space used by existing sparse file needs to be deallocated.
kIssGlaY
Posts: 24
Joined: Sat Jun 29, 2013 11:13 am

Re: File allocation problem when doing selective download

Post by kIssGlaY »

This issue is still there in 2.93.

BTW, this issue was fixed 2 years ago in the discontinued unofficial Transmission-QT after this thread was posted.
Post Reply