Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jul 2018 17:42:59 -0700
From:      Jack Humphries <jack@chillysky.com>
To:        freebsd-fs@freebsd.org
Subject:   tmpfs questions
Message-ID:  <CANxg70HnN0qtb7sp7w30_-Z7pSw=8y7cV9ChWkH18XJtDTPCXA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi everyone,

I'm trying to study the FreeBSD tmpfs implementation as a personal
project, and I had a couple questions. I've been looking through the
code for a week and modifying various parts. I appreciate any help!

1. It seems that vnodes are locked before being passed to the various
VOP functions in tmpfs (because there is a call to
MPASS(VOP_ISLOCKED(vp)) near the beginning of each function).
Therefore, is the implicit assumption that a thread that holds the
vnode lock has exclusive access to the corresponding tmpfs_node
struct? In other words, is this why there are accesses to the tmpfs
node variables even though the tmpfs node is not locked? Note: I see
tn_interlock, but based on a comment above it in the source, it only
protects tn_vpstate and tn_status.

2. What is the duplicate node list for (tn_dupindex)? If I had to
guess, it seems to have something to do with the case where one thread
calls readdir on a directory while another is modifying the directory,
but I'm not sure. Can someone explain this deeper?

Thanks.

Jack Humphries



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANxg70HnN0qtb7sp7w30_-Z7pSw=8y7cV9ChWkH18XJtDTPCXA>