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
[bug] BTRFS subvolumes are treated as different filesystems, hurting the performance of moving a torrent #1060
Comments
This is actually pretty nice, and I abuse it by having the incomplete-vs-finished dirs on different subvolumes. This greatly reduces space waste due to fragmented misaligned extents. Transmission's write patterns play with btrfs so badly that a torrent may take ~4 times the space. Such files are also damn slow to read. Rewriting the file turns this pathological layout to optimal, fully linear, big extented layout. On the other hand, You can test if my theory of your problem is right by running |
What I mean is that Transmission should do such a rewrite on btrfs in all cases, even when the finished dir is on the same subvolume, to fix the problem I mentioned. There's BTRFS_IOC_DEFRAG_RANGE but that's nowhere as good as a full copy+delete. |
Transmission doesn’t think that. Your operating system does. The POSIX implementation of tr_sys_path_rename is just a thin wrapper around rename(2). If rename(2) failed to create a hard link at the new location, Transmission falls back to a read-write loop. I am working on some improvements to that. See master...RobCrowston:kernelcopy-wip I don’t use Linux very often so I am happy to take feedback.
I use the same defragmentation trick (copy to a different volume after completion) on my machine, since I use ZFS. My ultimate goal is to make the file copy asynchronous, but that requires more work. |
Making file copy asynchronous seems rather unlikely in the existing codebase without substantial improvements in locking discipline. Currently, moving torrent data locks the entire session, which prevents basically anything else from happening. In order to make moves asynchronous, we need the ability to lock a single torrent without locking the session. It's unclear how much the existing code assumes the session is locked while holding a torrent lock. |
Looking at the code a bit more, there is a sticking point on the design of the per-session pool of open files. |
If someone using BTRFS want to take this on as an improvement project, I'd love to see a patch and would be happy to review it |
Wow, that's neat. I'm having a problem with finished torrents being fragmented and this may just solve it without needing to create an extra unnecessary filesystem To @leijurv I'm sorry about your problem. Perhaps you can do a work around with the configuration option script-torrent-done-enabled |
Even though I have just one filesystem, when I try and move a completed torrent from one folder to another, transmission thinks they are different filesystems since they're in different btrfs subvolumes, and therefore it reads the files in one by one and writes them one by one.
I've timed it, and moving the same folder is more than 10x faster just using
mv
and removing and readding the torrent, than letting transmission do it.Can there be an option to use the system
mv
instead of, uh, whatever it's currently doing to move the files?The text was updated successfully, but these errors were encountered: