bin/51151: du hardlinkmatching is slow - fix included

David Schultz das at FreeBSD.ORG
Sun Apr 20 01:30:04 PDT 2003


The following reply was made to PR bin/51151; it has been noted by GNATS.

From: David Schultz <das at FreeBSD.ORG>
To: Peter van Dijk <peter at dataloss.nl>
Cc: FreeBSD-gnats-submit at FreeBSD.ORG
Subject: Re: bin/51151: du hardlinkmatching is slow - fix included
Date: Sun, 20 Apr 2003 01:27:24 -0700

 On Sat, Apr 19, 2003, Peter van Dijk wrote:
 > +	snprintf(s, 32, "%u:%u", dev, ino);
 > +
 > +	if(tree_srch(&linktree, strcmp, s)==0)
 > +	{
 > +		tree_add(&linktree, strcmp, s, 0);
 > +		return(0);
 > +	}
 > +	else
 > +	{
 > +		free(s);
 > +		return(1);
 > +	}
 
 A hash table would be more appropriate here.  You could even
 preserve the original behavior of making infrequent calls to
 malloc() and most of the original code by using open addressing.
 In any case, pulling in another library is probably not desirable.
 
 If you would like to revise this patch, I would be happy to help
 you get it committed.  You might also want to take a look at
 style(9).


More information about the freebsd-bugs mailing list