Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 226077 - net-libs/libtorrent should use --with-posix-fallocate
Summary: net-libs/libtorrent should use --with-posix-fallocate
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Peter Alfredsen (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-12 14:27 UTC by Steven Robertson
Modified: 2008-06-28 11:32 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Robertson 2008-06-12 14:27:45 UTC
fallocate is a system call introduced in Linux >= 2.6.23, allowing preallocation of disk space without manually zeroing a file.  XFS and ext4 currently implement this call (as of 2.6.25).

libtorrent, in particular, is pretty bad about file fragmentation; a recent 3GB ISO downloaded through rtorrent was spread across 37523 fragments.  Ouch.

libtorrent 0.12.2 (and possibly earlier versions) have the --with-posix-fallocate configure switch which enables use of the new call when available.  This should theoretically eliminate most fragmentation with libtorrent-based apps.  Please consider adding --with-posix-fallocate to the ebuild for libtorrent.

Thanks in advance.
Comment 1 Peter Alfredsen (RETIRED) gentoo-dev 2008-06-28 11:32:08 UTC
But on filesystems that only nominally support this call, it works by touching every page of every file. Upstream does not recommend this for normal use and I tend to agree.

"There's no generic non-blocking way of allocating this space, and 
posix_fallocate seems to be implemented such that it just touches each page."

If it works on your system, I think this is a suitable place for EXTRA_ECONF to be used. Untill such a time as it can be guaranteed that posix_fallocate won't block access to the hard drive for a considerable time when starting a torrent on old filesystems, I'll consider the feature non-finished.

Write a patch (or make upstream write a patch) that makes posix_fallocate only be used on filesystems that support it well natively or wait for old systems to be discontinued.