xfs
[Top] [All Lists]

Re: readdir() ordering guarantees on XFS

To: dizzy <dizzy@xxxxxxxxx>
Subject: Re: readdir() ordering guarantees on XFS
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Tue, 10 Jun 2008 13:55:47 +1000
Cc: xfs@xxxxxxxxxxx
In-reply-to: <200806061634.13990.dizzy@roedu.net>
Mail-followup-to: dizzy <dizzy@xxxxxxxxx>, xfs@xxxxxxxxxxx
References: <200806061634.13990.dizzy@roedu.net>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.17+20080114 (2008-01-14)
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


<Prev in Thread] Current Thread [Next in Thread>