Adding concept of "dead" references to lockref

From: Linus Torvalds
Date: Sat Sep 07 2013 - 19:34:52 EST


Ok, I added the notion of having a dead entry to lockref, because it
simplifies the dcache code a bit. I committed and pushed out the
actual lockref infrastructure, but the actual dcache *use* of that
infrastructure is probably too late for 3.12, or at least it needs
some discussion.

I'm attaching the patch here (but it needs _current_ git as of not
very long ago for the new "dead lockref" support). It simplifies both
the actual killing of dentries (we used to pass this "ref" thing
around to show whether we held the last ref to the dentry or not, this
makes it pointless because we'll just overwrite the refcount anyway)
and it particularly simplifies the getting the reference for the RCU
case, because the whole "it's valid but we couldn't tell" case is
gone.

Comments? It doesn't matter for my insane test-case, since that one
was either looking at a directory with non-zero refcount to begin
with, and even if you looked up a regular file, all the other people
looking it up would guarantee that non-zero refcount. But it basically
makes the (common) special case of "we got the dentry d_lock because
we're looking up a file that nobody else had actively open yet", and
now that's just a reference count operation too.

Simpler code and one less special case sounds like a good thing to me.

Linus

Attachment: patch.diff
Description: Binary data