information on identifying hard links to a file
Shachar Shemesh
rsync at shemesh.biz
Sat Feb 11 16:11:14 GMT 2006
Wayne Davison wrote:
>On Thu, Feb 09, 2006 at 03:04:17PM +0100, Paul Slootman wrote:
>
>
>>compare inode and device number. When those are the same, the two files
>>must be hardlinked.
>>
>>
>
>Also, rsync only considers files that have a link count larger than 1
>(see stat()'s st_nlink) since this allows it to ignore the vast majority
>of files that have only one link into a filesystem.
>
>..wayne..
>
>
Do we also discard the info once we found file names in a quantity that
matches the link count? This should allow us to dramatically reduce the
memory usage for large transfers.
Example:
Found file "foo1" with dev 304, link count of 2 and inode 17. Cache it.
Found file "bar1" with dev 304, link count of 3 and inode 18. Cache it.
Found file "bar2" with dev 304, link count of 3 and inode 18. Mark it as
link to bar1.
Found file "foo2" with dev 304, link count of 2 and inode 17. Mark it as
link to foo1 and remove the link cache (found two matches to a file that
has two links).
Shachar
More information about the rsync
mailing list