SUNRPC: move bkl locking and xdr proc invocation into a common helper

Since every invocation of xdr encode or decode functions takes the BKL now,
there's a lot of redundant lock_kernel/unlock_kernel pairs that we can pull
out into a common function.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
J. Bruce Fields 2007-07-11 18:39:02 -04:00 committed by Trond Myklebust
parent e3a535e173
commit be879c4e24
3 changed files with 23 additions and 27 deletions

View file

@ -12,6 +12,7 @@
#include <linux/uio.h>
#include <asm/byteorder.h>
#include <linux/scatterlist.h>
#include <linux/smp_lock.h>
/*
* Buffer adjustment
@ -35,6 +36,21 @@ struct xdr_netobj {
*/
typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj);
/*
* We're still requiring the BKL in the xdr code until it's been
* more carefully audited, at which point this wrapper will become
* unnecessary.
*/
static inline int rpc_call_xdrproc(kxdrproc_t xdrproc, void *rqstp, __be32 *data, void *obj)
{
int ret;
lock_kernel();
ret = xdrproc(rqstp, data, obj);
unlock_kernel();
return ret;
}
/*
* Basic structure for transmission/reception of a client XDR message.
* Features a header (for a linear buffer containing RPC headers