1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-22 16:42:56 -08:00
Commit Graph

66 Commits

Author SHA1 Message Date
jsg
d2b6e45e60 move some server only functions from nfs_subs.c to nfs_srvsubs.c
saves space on ramdisks that have option NFSCLIENT

initial diff from and ok miod@
2024-09-09 03:50:14 +00:00
jsg
0af06ae556 remove prototypes for removed functions 2024-05-04 11:25:24 +00:00
miod
a43f2b810b Convert all the NFS macros (in nfsm_subs.h) into inline functions with the
appropriate extra arguments.

This (hopefully) completes the unmessyfication work started by thib@ a long,
long time ago (in a galaxy far away).

The conversion logic has been:
- nfsm_dissect has been turned into an rvalue expression, leaving the
  cast operation up to its caller.
- macros which had three different exit paths (return, goto nfsmout or
  fallthrough) have been split so that no macros have more than two exit paths.
- then they have been modified to return a value, which lets the caller
  figure out what exit path is needed.
- local variables abused by the macros are now local variables of the new
  inline functions.

This single commit is the sum of 25 intermediate diffs, which have all been
carefully reviewed by (at least) jsg@ and semarie@.

Tested with v2 and v3 servers and clients.

ok jsg@ semarie@
2024-04-30 17:04:23 +00:00
mpi
fe1f2e8dc0 Keep local definitions local.
"good work" deraadt@, ok visa@
2017-02-22 11:42:46 +00:00
dlg
b78d9702d9 replace the use of RB macros with the RBT functions. 2016-09-27 01:37:38 +00:00
beck
9b247b225e Fix some gibbering horrors due to uninitialized struct nameidata's
1) turn NDINITAT into a function and make the macros point to it
with the later goal of getting rid of them.

2) Sweep the kernel for places where people make a struct nameidata manually
on the stack and fill in what they hope are the required fields and count
on prayer and clean living to always get them right. Instead use NDINIT
everywhere. NFS was especially bad for this and there have likely
been things lurking there for a while.

3) Add a couple of strategic KASSERT's to catch future offenders.

ok krw@ sthen@ deraadt@
2016-04-29 14:40:36 +00:00
deraadt
1abdbfde51 final removal of daddr64_t. daddr_t has been 64 bit for a long enough
test period; i think 3 years ago the last bugs fell out.
ok otto beck others
2013-06-11 16:42:02 +00:00
beck
9e768a18b9 Don't jump the queue if we have to wait on the client side because
the nfs_bufq is full - instead tsleep waiting for one of our nfsiod's
to free up space for us in the queue so we can enqueue on the end.

ok blambert@, tedu@, oga@
2010-04-12 16:37:38 +00:00
thib
9c9522aef4 Backout the asyncio/aiod change, as it causes buf's to get hung.
problem noticed by deraadt@

ok beck@
2009-09-02 18:20:54 +00:00
thib
0324048376 Rework the way we do async I/O in nfs. Introduce separate buf queues for
each mount, and when work is "found", peg an aiod to that mount todo the
I/O. Make nfs_asyncio() a bit smarter when deciding when to do asyncio
and when to force it sync, this is done by keeping the aiod's one two lists,
an "idle" and an "all" list, so asyncio is only done when there are aiods
hanging around todo it for us or are already pegged to the mount.

Idea liked by at least beck@ (and I think art@).
Extensive testing done by myself and jasper and a few others on various
arch's.

Ideas/Code from Net/Free.

OK blambert@.
2009-08-20 15:04:24 +00:00
blambert
7e7d00e2dd Teach nfsm_fhtom about nfsm_info structs
ok thib@
2009-08-13 15:18:16 +00:00
blambert
c2e93c1830 change version 3 post-operation attribute building function to not
use mbufs directly, but the shiny new nfsm_info struct

ok thib@
2009-08-13 15:03:19 +00:00
thib
e54eb321b5 Use an RB tree instead of a hashtable for fh/node lookups.
Idea from NetBSD.

OK blambert@
2009-08-10 10:59:11 +00:00
thib
a57b0483d0 Remove the v2 writegather code. It did help alot back in the 80s
but extensive performance benchmarking done by myself and jasper@
has shown that it doesn't help, at all - even on vaxens and in some
cases it makes things significantly slower.

"this excites me sexually" jetpack@
Tested by jasper@.
OK blambert@
2009-08-10 09:38:44 +00:00
thib
0ea6bae062 group all of the on-stack variables that are uses by the nfsm_macros
to keep the data munging "state" into an nfsm_info structure. Each
function now has this structure on its stack, and it and its members
are now passed around so that the macros/functions can work there magic.

this will make removing the nfsm_* macros way easier.

Idea/code picked up from DragonflyBSD.

Tested by krw@, jacekm@ and myself.

OK blambert@.
2009-08-04 17:12:39 +00:00
blambert
615e568b2c simplify argument list for nfssvc_nfsd()
ok thib@
2009-06-04 01:02:42 +00:00
blambert
9132d9d2ef Convert macros to functions to reduce kernel memory usage.
In snaps for a while (way too long, according to deraadt@)
2009-04-13 17:51:57 +00:00
blambert
895d09cc12 Convert a sizeable macro to a much-leaner function. Saves (IIRC) 5k on i386.
In snaps for a while.
2009-03-30 19:58:50 +00:00
blambert
27c8e2947e Start reworking NFS client mbuf handling by creating an interface which
requires well-formed mbuf chains to work. Existing function name is now
a wrapper to this interface. Much, much more work to follow which will
build on this.

Truly change we can believe in.

ok thib@, who would have preferred this in two commits, but I'm impatient :)

testing on multiple arches (i386, arm, amd64, and sparc64 at least) by many,
thanks to all who did so
2009-01-20 18:03:33 +00:00
blambert
0c2e025bee remove function which only called nfssvc_iod(), and pass nfssvc_iod()
to kthread_create()

ok thib@
2009-01-18 21:04:41 +00:00
thib
3a8994739d turn nfs_msg into void functions, also make it take an nfsreq
argument since all of the info we need is there, makes it and
the use it a tad bit nicer.

ok blambert@
2009-01-16 17:11:28 +00:00
thib
52306f75b7 remove prototypes for nonexistent functions 2009-01-15 19:41:18 +00:00
blambert
c54ca9beb8 Don't hide the fact that NFS uses vop_generic_* functions behind
#define's in nfs_var.h

ok thib@
2008-10-16 07:57:06 +00:00
thib
d6679b5c37 o nfs_vinvalbuf() is always called with the intrflag as 1, and then
checks if the mount is actually interrutable, and if not sets it 0.
  remove this argument from nfs_vinvalbuf and just do the checking inside
  the function.
o give nfs_vinvalbuf() a makeover so it looks nice. (spacing, casts, &c);
o Actually pass PCATCH too tsleep() if the mount it interrutable.

ok art@, blambert@
2008-08-09 10:14:02 +00:00
thib
28949a5ba1 put the canonical ifdef dance for multiple inclusion, also put all the
contents of this file inside #ifdef _KERNEL; there's nothing here that
userland should ever need/touch.

but then again, some userland programs define _KERNEL before they include
kernel header files *shrugh*...

survived a build, OK blambert@
2008-06-14 00:23:26 +00:00
blambert
eaaf7dadba Kill one-liner macro which obfuscated mbuf pointer assignment.
Rescue nfsm_reqhead macro name and rename nfsm_reqh.

End of one-liners from nfsm_subs.h.

ok thib@
2008-06-13 22:11:32 +00:00
blambert
5a0357639a Replace one-line macro which only obfuscated the fact that
the function it was named after took 4 arguments instead of 2.

"get it in; get it in; get it in" thib@
2008-06-13 03:49:26 +00:00
blambert
65faa1c0af Remove now-vestigial bpos pointer from NFS. For building outgoing
NFS mbufs, mbufs now contain all their internal buffer state internally,
the way god intended.

ok thib@

testing johan@ (and possibly merdely@; this diff's been around for a bit...)
2008-06-12 20:24:06 +00:00
thib
c7d932a0ae o Avoid putting duplicate entries into the name cache,
add a function to handle cache_enter()'s for us since
  we need to update the appropriate timestamps so we don't
  miss on lookup;
o Do not purge the dvp in nfs_rmdir(), since there's no need;
o cache the new entry created in nfs_mkdir();
o Do caching of the access modes, this drastically reduces the
  amount of over the wire access RPCs we do in the NFSv3 case.

This diff was written by Pedro Martelletto, sometime in 2004.
A lot of people have been running with it at one time or another,
this includes at least markus and matthieu.

OK deraadt@, blambert@
2008-06-10 22:59:09 +00:00
djm
f1b31bc741 nfsm_get_xid() => nfs_get_xid() after thib@ informed me that the
nfsm_* functions are for mbufs
2008-06-09 22:49:15 +00:00
djm
ca6e56f20e Introduce a facility to generate unpredictable 32 bit numbers with
near maximal (2^32) cycle times. These are useful for network
IDs in cases where there are negative consequences to ID prediction
and/or reuse.

Use the idgen32() functions to generate IPv6 IDs and NFS client/server
XIDs.

Pseudorandom permutation code in crypto/idgen.c based on public
domain skip32.c from Greg Rose.

feedback & ok thib@ deraadt@
2008-06-09 22:47:41 +00:00
thib
044b565ee2 remove the "kerbflag" argument from nfsrv_fhtovp() and nfs_namei()
(the latter only had it to pass it to nfsrv_fhtovp()).

appropriate cleanup also;

ok blambert@
2008-04-22 18:53:34 +00:00
blambert
63fd1d0759 Rework NFS mbuf write routines:
nfsm_uiotombuf():
- no meaningful return, function becomes void
- replace frankensteined uiomove/MGET with actual call to uiomove

nfsm_strtmbuf():
- no meaningful return, becomes void
- rename and reorder parameters to be consistent with other functions
- becomes wrapper to nfsm_uiotombuf

nfsm_buftombuf():
- new function; unused but slated for future use
- wrapper to nfsm_uiotombuf

As a bonus, making these functions void removes much unneeded code and
garbage collects `magic' variable t2 which was only used (invisibly)
by the macros from nfsm_subs.h

Preps the way for removing much more NFS goo...

testing by myself, thib@ and merdely@
ok thib@
2008-04-14 13:46:13 +00:00
blambert
1d99196e7b More NFS-related kernel shrinkage...
When you use a macro ~200 times, it tends to bloat your code, so make a
function out of it.

Shaves ~8.5 kB from my kernel.

ok thib@, "looks good" krw@

In snaps for 1+ week with no negative reports.
2008-01-06 17:38:23 +00:00
blambert
ebaba6ec21 convert massive (expanded to 150+ lines) nfsm_v3attr macro to a function
shaves an insane (~8K) amount from an i386 kernel

ok thib@
2007-12-13 18:32:55 +00:00
thib
b4f07eb061 Remove the "frev" argument from nfs_rephead(); and clean up the "frev"
variables, that are declared all over, since they are passed via macros
to nfs_rephead(); which doesn't do anything with it.

OK krw@
2007-10-28 14:12:41 +00:00
thib
e255ace58d Remove now unused functions dealing with kerberos
authentication.

ok beck@
2007-10-14 19:34:41 +00:00
thib
37c1538aa1 Remove alot of dead kerberos code (add sane comments too).
Cleanup and partly redo the way we create the RPC header, by having
nfsm_rpchead() do a bit more work. Right now this is pretty RPCAUTH_UNIX
centric, but since it is the only auth method we support right now thats
fine.

Make sure we can never generate a zero xid, thats forbidden by the RFC.

Misc cleanup.

tested by a few.
2007-10-13 17:38:43 +00:00
thib
1f7dd9ae1d remove a whole bunch of duplicate function
prototypes.
(survived build/release on macppc/amd64).

ok pedro@
2007-06-21 22:59:49 +00:00
thib
9cc4c30ad3 daddr_t -> daddr64_t;
Basically the usage of daddr_t was to math out arguments to
nfs_getcacheblk, wich calls getblk();

ok deraadt@
2007-06-01 07:13:47 +00:00
thib
fad52cc095 Replace the nfskevq_lock lockmgr lock with rwlock.
Replace nfs_kqinit() wich just calls lockinit with
RWLOCK_INITALIZER. Assorted cleanup.

ok tedu@
"reads good" art@
2007-04-19 14:46:44 +00:00
thib
620fc945c8 Move the declaration of VN_KNOTE() into vnode.h instead of having
multiple defines all over;

ok tedu@
2007-04-13 17:09:22 +00:00
thib
34d9ef7e9e remove duplicate prototype;
ok pedro@
2007-04-11 12:18:54 +00:00
marius
e4c869ec83 NFS commit coalescion: instead of sending a commit for each block, coalesce
these into larger ranges wherever possible.

this should speed up NFS writes quite a bit.

ok art@ millert@ pedro@ tedu@
2004-08-03 17:11:48 +00:00
marius
c667ebb95e kqueue support for NFS, adapted from netbsd.
ok art@ pedro@, "get it in" deraadt@
2004-07-21 17:30:55 +00:00
nate
6c90fdaf69 Remove unused function parameter 'cache' from nfs_rephead
ok costa@
2002-07-03 20:57:00 +00:00
ericj
4114e07e11 use hash.h for nfs_hash as well as namei's hash
ok art@ costa@
2002-07-02 04:23:25 +00:00
csapuntz
6aaa5f1f64 nfs_realign from FreeBSD. The old code was over-optimized, occasionally overwriting
other parts of a TCP stream, occasionally dereferencing NULL pointers
2002-04-10 18:16:46 +00:00
millert
c4071fd138 First round of __P removal in sys 2002-03-14 01:26:25 +00:00
art
1414b0faee UBC was a disaster. It worked very good when it worked, but on some
machines or some configurations or in some phase of the moon (we actually
don't know when or why) files disappeared. Since we've not been able to
track down the problem in two weeks intense debugging and we need -current
to be stable, back out everything to a state it had before UBC.

We apologise for the inconvenience.
2001-12-19 08:58:05 +00:00