Re: information on identifying hard links to a file
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 -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: information on identifying hard links to a file
On Thu 09 Feb 2006, yogesh kulkarni wrote: Am presently working on rsync and would like to know how does rsync identify hardlinks.I have gone through the hlink.c file and have not really understood the flow presented in the function.If anyone can provide some more info on this please inform me. It does it the same way any application does: compare inode and device number. When those are the same, the two files must be hardlinked. Paul Slootman -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: information on identifying hard links to a file
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.. -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: information on identifying hard links to a file
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. That's a fine rule and a lot of programs use it. It's also a very important rule: without it, every backup I do using rsync would run out of memory. I already have one directory in my home directory which has so many hard links that it cannot be copied (with -H) at the same time as the rest of my home directory, due to running out of memory if I try. So it's unfortunate that Linux bind mounts break the rule. They create multiple paths to files, including different names for the same files, which can still have a link count of 1. -- Jamie -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html