Patch for inode SLIST conversion

Michael Neumann mneumann at
Sun Jan 20 03:43:01 PST 2008

Simon 'corecode' Schubert wrote:
Michael Neumann wrote:
Now, ufs_ihashget doesn't modify the hashtable at all. So why not 
store a "transaction id" in each hash table bucket, which gets 
increased by ufs_ihashins and ufs_ihashrem. Then in ufs_ihashget I 
read in this id *before* calling vget and check afterwards if it has 
changed. If it is unchanged, I can omit a second pass over the linked 
This could be an efficient, but not generic solution.  I was thinking of 
something like this:  Have a generation counter in the tokens.  If you 
release a token and somebody else aquires it, the generation will 
change.  Have a function lwkt_token_stale() to check whether the token 
has been used by somebody else since the last check/aquire.  How does 
that sound? This could be applied to different areas in the kernel which 
use tokens.
You mean to add a generation field to lwkt_token plus a 
current_generation field to lwkt_tokref?

lwkt_token_stale(&lock, &token) would then simply check
for ilock->current_generation == token->generation, and
lwkt_gettoken() would increase the generation. Alternatively
a special lwkt_token_inc() could be used to increase the generation.
Don't know if the overhead is justified. Probably only if it's used
that often.


More information about the Kernel mailing list