Move decl. of local variable entry, triggers false warning (gcc 4.7.1).

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Conflicts:
	src/Protocols/NFS/nfs4_op_open.c

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Update tirpc.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Streamlined and Per-Connection DRCs

This change provides a next-generation duplicate request
cache, based on design ideas from Philippe Deniel, myself,
Frank Filz, and, in particular, Eitan Ben-Amos, who argued
strongly for per-connection DRCs.

A DRC may be per-connection (TCP) or shared (UDP).  A TCP
DRC keeps a FIFO queue of expired requests, and can itself
be recycled (to support rebinds).

TCP DRCs are assigned by client address, and will be shared
if a client makes multiple connections from the same address.
A client which attempts ad-hoc trunking of NFSv3 or NFSv4
connections with XID consistency, may see correct results (if
any such client exists).

Duplicate request caching is performed for NFSv2, NFSv3, and
NFSv4.x, x<1.  While all NFS requests pass through the new
DRC layer, there is no caching overhead for NFSv4.1 requests,
which are threaded through the svc_req.

DRCs are a closed-form hashing variation of Ganesha
partitioned dictionaries.  The implementation is new, using
shared TI-RPC primitives.  A new retire-window heuristic is
used to assure that at most 'k' entries are retained in
cache, if no duplicate requests have been seen.  A system
which has seen duplicate requests may clear its retire window
will converge on a zero window after a corresponding number
of non-duplicate requests has been successfully processed.
Full checksumming support is implemented, using MurmurHash3).

Minor:  likely/unlikely compiler macros have been added as a
convenience (include/gsh_intrinsic.h).

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Conflicts:

	src/MainNFSD/nfs_init.c
	src/MainNFSD/nfs_worker_thread.c
	src/RPCAL/nfs_dupreq.c
	src/include/nfs_dupreq.h
	src/include/nfs_proto_functions.h
	src/tirpc.sh

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Don't overrun in hashing.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Pass nfs request to nfs_dupreq_start.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Conflicts:

	src/RPCAL/nfs_dupreq.c

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Implement drc_free_expired.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Always assign req->rq_u1 in nfs_dupreq_start.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Don't leak drc_st->mtx in nfs_dupreq_put_drc.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Finish any reqeuest we started.  Cleanups.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Hash fix.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Don't hash more bytes than we assigned.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Actually free expired, dequeued DRCs.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Fix uninitialized read in DRC

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Fix invalid write DRC

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Fix invalid write DRC

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Fix DRC alloc and init functions (cache setup).

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Fix null derefs in special cases.  Add tracing.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Fix comments.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Fix comments.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Rework state traces.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Rework state traces.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

rbtree_x cache now requires saving cachesz in xt.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Enable TI-RPC lock trace flag (disable later).

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Parameterize DRC tunables.

Various caching, high-water mark, and timeout parameters are now
configurable.  Settings documented in the VFS config sample.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Oops.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Support NFSv41 (passes through DRC at no cost).

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Conflicts:
	src/MainNFSD/nfs_worker_thread.c
	src/Protocols/NFS/nfs_proto_tools.c
	src/RPCAL/nfs_dupreq.c

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Remove LRU_List.

With new DRC, there are no clients of LRU_List.  This
change removes it from the codebase.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Conflicts:

	src/MainNFSD/nfs_worker_thread.c
	src/RPCAL/nfs_dupreq.c

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Clear stats in collect to fix uninitialized reads

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Fix overlapping memcpy in cache_inode_rename

We want to getattr to make sure our attributes are fresh, but we don't
actually need a copy at any point.  This will be undone on
callbackification of getattr.

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Conflicts:
	src/Cache_inode/cache_inode_remove.c

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Remove memsets from, and also disable, constructors for
request_data_t and nfs_request_data_t.

The pool will return zeroed memory by default, and a memset can be
saved completely.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Use compiler bool.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Conflicts:
	src/include/nfsv41.h
	src/tirpc.sh

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
DRC spinlocks and TAILQ

Now that TI-RPC has full BSD queue.h, use it.  In fact,
misc/queue.h has small convenience extensions, including the
TAILQ_IS_ENQUEUED macro, use those.

Also, the pthread mutexes formerly serializing drc_t and
dupreq_entry_t objects were written to a spinlock profile, so
go ahead and use pthread spinlocks.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Update tirpc.sh

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Fix old-style attrs decls in cache_inode_remove.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Rebaseme:  DRC change.
De-p-ify worker_data in nfs_worker_thread.c.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>