Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Torrent padding files

Did anyone created padding files for torrent? How many clients use this stuff nowadays? Is "padding files" comprehensive?

I didn't found this feature in new clients such as ctorrent,ttorent, trasmission etc.

Do you have implementaions of this feature or some theory or history about this?

I will be appreciated for answers!

like image 599
pic0 Avatar asked Aug 10 '15 17:08

pic0


1 Answers

This feature was originally implemented by BitComet (with fairly poor quality of implementation in my opinion) as a way to make it simpler to de-select certain files from being downloaded. Since bittorrent downloads pieces, and pieces may span multiple files. Otherwise when you de-select some files you may still get the first and last bit of it (because it overlaps pieces that you need for other files).

Introducing pad-files ensures that files are aligned to pieces and make this problem go away.

Notably, uTorrent instead would stick these left-over pieces in a separate file, called a part file.

In more modern times, a couple of years later, libtorrent and uTorrent got some support for pad files, for a different reason. Primarily these two:

  1. uTorrent implemented support for "mutable torrents", the ability to replace a torrent with a new version and efficiently transition/duplicate all common content to the new torrent. In order to efficiently use this feature at scale, you have to align large files to pieces to avoid having to re-hash all content (i.e. you only want to hash the new content, not the content that stayed the same). For this reason, pad files were useful.

  2. Accessing the filesystem at cluster aligned offsets within files is potentially a lot cheaper than unaligned access. It also allows use of some more sophisticated APIs that may restrict file offsets (async. I/O). This is also true for memory mapped files.

The main criticism of pad files (as far as I can tell) came out of BitComet's implementation which was quite intrusive to clients not implementing it. It would create prominent files with long filenames suggesting downloading a newer version of BitComet. At least in hte uTorrent camp this upset a lot of users, to the point where some .torrent files were created to deliberately screw with this feature in bitcomet (where the pad files were not all zero, which bitcomet would assume, so it failed its hashes).

There are more elegant ways of implementing pad files, and I believe libtorrent and uTorrent do it better. For instance, you can consolidate all pad files in a (hidden) directory when creating the torrent. uTorrent will also put partial pad files in its partfile.

As for clients supporting pad files, here are some I can think of off the top of my head (given sufficiently recent version):

  1. uTorrent
  2. BitTorrent
  3. Deluge
  4. qBitTorrent
  5. BitComet (I assume it still supports it)
  6. any other client using libtorrent (rasterbar)
like image 79
Arvid Avatar answered Sep 22 '22 13:09

Arvid