>We've just stumbled across an interesting problem in one of our
>applications that fails when run on a ZFS filesystem.
>
>I don't have the code, so I can't fix it at source, but it's relying
>on the fact that if you do readdir() on a directory, the files come
>back in the order they were added to the directory. This appears
>to be true (within certain limitations) on UFS, but certainly isn't
>true on ZFS.
>
>Is there any way to force readdir() to return files in a specific order?
>(On UFS, we have a scipt that creates symlinks in the correct order.
>Ugly, but seems to have worked for many years.)

No.  In UFs a readdir is a "file" and all new files are added at the end
unless there's room before the end.  ZFS uses Btrees and returns them
in btree order.

>If not, I was looking at interposing my own readdir() (that's assuming
>the application is using readdir()) that actually returns the entries in
>the desired order. However, I'm having a bit of trouble hacking this
>together (the current source doesn't compile in isolation on my S10
>machine).


I think this is going to be rather difficult; I think you want to 
interposing opendir() also and read all the files first before
you start returning them.

Casper

_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to