Widening ext4's readdir() cookie
Posted Mar 28, 2013 9:07 UTC (Thu) by
paulj (subscriber, #341)
In reply to:
Widening ext4's readdir() cookie by paulj
Parent article:
Widening ext4's readdir() cookie
And further, this bit of the article made me scratch my head and wonder which of my understanding, the description of the issues involved in the article, and/or the code is suboptimal:
"Although there is no notion of an offset inside a B-tree, the implementers of modern filesystems must still support the readdir API (albeit reluctantly); indeed, support for the API is a POSIX requirement. Therefore, it is necessary to find some means of supporting "directory position" semantics. This is generally done by fudging the returned offset value, instead returning an internally understood "cookie" value. The idea is that the kernel computes a hash value that encodes some notion of the current position in a directory (tree) and returns that value (the cookie) to user space.
Encoding the position in the tree in the cookie through a hash? But the tree is indexing something with an absolute order - the very node in the true MUST be associated with a unique value already (e.g. the name), surely? Why would you then hash this?
(I'm assuming I'm having a pre-morning-caffeine stupid moment :) ).
(
Log in to post comments)