[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: retrieving exteneded attributes speed issues



On Fri, 2002-05-31 at 15:20, Anmar Oueja wrote:
> What's the best way of efficiently retrieving all extended attributes of
> a file on an XFS partition?
> 
> Now I'm doing what the utility getattr does:
> 
> 	call listxattr() to get size of all attr names
> 	reallocate memory if necessary
> 	call listxattr() again to get all attr name strings
> 	for each attr name
> 		call getxattr() to get size of attr value
> 		reallocate memory if necessary
> 		call getxattr() again to get the attr value
> 
> 
> The problem is that the approach is not good at handling large number of
> files (in the order of 10000 or more.) Same application, without
> retrieving extended attributes, took 7 minutes finishing its job; 20
> minutes if retrieving extended attributes were included.
> 
> Profiling shows that system calls introduced by the retrieval (such as
> listxattr and getxattr) take most extra time. From the pseudo code above
> we can see this, too. At least 4 system calls are required to retrieve
> all extended attributes of one file.
> 
> Is retrieving extended attributes inherently slow? Or is there better
> way to do the job?


You could look through the xfsdump code and see how it does it, no
guarantee it is super efficient, but it can back them up.

Steve

> 
> 
> Anmar
> 
-- 

Steve Lord                                      voice: +1-651-683-3511
Principal Engineer, Filesystem Software         email: lord@sgi.com