dizzy <dizzy@xxxxxxxxx> writes:
> Can someone tell me (in English or C :) ) the algorithm of the sorting order
> of the entries in an XFS directory as I would get them with a readdir() (or
> shell "find" command)?
>
> I am trying to figure it out by reading linux/fs/xfs/xfs_dir2*.c code but I
> don't seem to be doing much progress and I was hoping maybe someone that
> knows these details can help.
I believe it computes a hash over the name and then sorts by the hash
numerical value. At least the b*tree large directories do, small inline
directories might be different (XFS uses different algorithms for
different directory sizes)
The hash function is in xfs_da_btree.c:xfs_da_hashname()
With the recent case insensitive support there are also differences
on the file systems which have that enabled.
Also better don't rely on it never changing.
-Andi
|