On Fri, Jun 06, 2008 at 04:34:13PM +0300, dizzy wrote:
> Hello
>
> POSIX leaves unspecified the order of getting the entries with readdir().
> This
> is normal since different filesystems may implement their own techniques to
> organize entries in a directory (linear, hash, various search trees, etc).
>
> But if I can makes sure that several Linux machines will have the same FS (ie
> XFS), mount options and same kernels can assume that traversing the same file
> hierarchy structure (that is a file structure with the exact same directories
> and files as names, structure, attributes, except maybe "ctime" which we
> can't really control in Linux) can I expect that traversing using readdir()
> will give me the entries in the exact same order?
No. For speed I suggest sorting the inode stat() calls in ascending
inode number order before issuing them. Also, perhaps you should
look at:
http://oss.oracle.com/~mason/acp/
To see if you can use similar techniques to speed directory
traversal.
Cheers,
Dave.
--
Dave Chinner
david@xxxxxxxxxxxxx
|