On Sat, Apr 04, 2020 at 09:33:26PM +0000, Andrew Doran wrote:

> This change makes vcache_tryvget() do its work by means of a single atomic
> operation, which removes the need to take v_interlock beforehand.

I re-did this one more elegantly.  Assuming no problems I plan to commit
some time this week.

        http://www.netbsd.org/~ad/2020/vget.diff

The basic idea: have a "gate" bit in v_usecount that's only set when the
vnode is LOADED.  vcache_tryvget() needs to see this otherwise it fails and
we go down the slow path instead.  The state transition for reclaiming is
then:

        ...
        LOADED
        -> BLOCKED
        confirm that caller still holds the last vnode reference
        -> RECLAIMING
        ...

Cheers,
Andrew

Reply via email to