]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfsprogs: metadump: don't loop on too many dups
authorAlex Elder <aelder@sgi.com>
Fri, 25 Feb 2011 18:13:44 +0000 (18:13 +0000)
committerAlex Elder <aelder@sgi.com>
Tue, 8 Mar 2011 18:04:29 +0000 (12:04 -0600)
commit88b1fe2aa7fded8f5036ec32cba6f576503aa235
tree9e2780901a8e79b246500a6f1e3dbcef6fbadb7b
parentc2e10856e0b5142e9b6d587af221c4d679830232
xfsprogs: metadump: don't loop on too many dups

Don't just loop indefinitely when an obfuscated name comes up as a
duplicate.  Count the number of times we've found a duplicate and if
if it gets excessive despite choosing names at random, just give up
and use the original name without obfuscation.

Technically, a typical 5-character name has 255 other names that can
have the same hash value.  But the algorithm doesn't hit all
possible names (far from it) so duplicates are still possible.

Updates (v4):
- Rearranged things a bit so that if too many duplicates are
  encountered, a warning gets emitted.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
db/metadump.c