dotcloud/docker — pull request #2304 by unclejack (2013-10-19 01:35:31+00:00)
Title: fix layer size computation: handle hard links correctly

This change makes docker compute layer sizes correctly.

The old code isn't taking hard links into account. Layers could appear as being 1-1.5-2x larger than they really were when a lot of hard links are involved.

With this change, the layer size is being computed correctly and reported exactly the same as `du`. The reason why it has to be computed correctly and take hard links into account is because that's the real amount of space that data is going to take.

Tar also handles hard links and the data isn't showing up twice in the tarball. That means there's no reason for Docker to compute the amount of space these layers are taking up on disk in any other way, other than the same way as `du`.