[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
retrieving exteneded attributes speed issues
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?
Anmar