'td' vs sys/fs/nfsserver/

Edward Napierala trasz at freebsd.org
Tue Mar 5 09:26:57 UTC 2019


Hello.  As many of you know, right now, throughout the kernel,
there’s the ‘td’ argument being passed over and over, even though
we have a cheap way of accessing it by using ‘curthread’.  That’s
suboptimal for obvious reasons.  It can’t be fixed ‘just like that’,
as it would introduce a lot of code churn, and also possible bugs
in case we miss a case where the ‘td’ is not equal to curthread.
So, here's the big picture: this is what I'm _not_ intending
to do at this point.

What I do intend doing is to go and try to fix it in a single kernel
component, the NFS server.  The idea: drop the ‘td’ argument (in
case of NFS server it’s usually spelled ‘p’ due to historical
reasons) where it’s unused, which turns out to be quite often, and
otherwise push ‘td’ down, function by function, so that when you
review it it’s obvious that it’s equal to curthread.  There are
three reasons to do this: first, it makes it very obvious that
the
td passed to various VOPs it calls is indeed always curthread,
and makes it easier to do the change described in the previous
paragraph, should someone try it.  Second… well, it’s a cleanup:
the NFS code passes it everywhere, and in many cases it's not used
at all.  Third, and this is the man reason: it’s a good way to test
the idea of pushing td down layer by layer without touching any
APIs that are not local to the NFS server, to see if it works, and
if it doesn't annoy people to much.  


So, since I’ve been asked to
discuss it in public first: what do you guys think?


More information about the freebsd-fs mailing list