LWN.net Logo

Advertisement

Free copy of The Founder's Checklist and The Founders Pitch Deck Template from M L Bittle - New York; Advisor/Coach.

Advertise here

A kernel change breaks GlusterFS

A kernel change breaks GlusterFS

Posted Mar 28, 2013 0:35 UTC (Thu) by bfields (subscriber, #19510)
In reply to: A kernel change breaks GlusterFS by jengelh
Parent article: A kernel change breaks GlusterFS

Traditionally the cookie is a byte-offset into some linear representation of the directory. If you do that, then in practice a "64 bit" cookie in practice probably isn't going to exceed 2^32 until you have millions of entries.

ext4 is unusual in that it uses a hash of the filename as the cookie--so the 64-bit cookies are effectively random 64-bit sequences, and really do use the high bits.

(Well, OK, actually they're limited to 63 bits, but you get the idea.)


(Log in to post comments)

A kernel change breaks GlusterFS

Posted Mar 28, 2013 9:20 UTC (Thu) by paulj (subscriber, #341) [Link]

So really it'd be much better (ignoring legacy constraints) to use the filename as the handle for any readdir-like directory iteration operation?

A kernel change breaks GlusterFS

Posted Mar 28, 2013 9:52 UTC (Thu) by dlang (✭ supporter ✭, #313) [Link]

Sure, except that there are those pesky legacy constraints.

The latest NFS protocol specifies that the token passed over the wire is a 64 bit value (earlier versions specified a 32 bit value)

Other network filesystems have similar specifications.

In fact, from a little googling, it looks like the POSIX spec says that these cookies are of type 'long'. this makes changing it to something like a variable length string like you would need to use the filename extremely hard.

A kernel change breaks GlusterFS

Posted Mar 28, 2013 10:32 UTC (Thu) by paulj (subscriber, #341) [Link]

Sure. There's 2 trains of thought going through my head:

a) How to get a stable order over fixed-length IDs (dir size limited to the ID space then).

b) Assuming you can't get that, how would you design sane APIs that still allowed iteration of directories?

For b, it's names. However, I still don't understand why 'a' isn't possible. See my comment on the companion ext4 article about using a ring for the ID space.

A kernel change breaks GlusterFS

Posted Mar 28, 2013 16:29 UTC (Thu) by Cyberax (✭ supporter ✭, #52523) [Link]

Use "last returned filename" as a cookie. Easy and simple - Amazon does this for S3 and it works splendidly.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds