diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2007-07-11 18:39:02 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-19 15:21:39 -0400 |
commit | be879c4e249a8875d7129f3b0c1bb62584dafbd8 (patch) | |
tree | 6d6d774ac4dd24ff280e83e1d6a65be29a6dc6f8 /include/linux | |
parent | e3a535e1739a9da3cc316ccdfe5cd4bf84d745ac (diff) |
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>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/sunrpc/xdr.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index 9e340fa23c06..c6b53d181bfa 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/uio.h> | 12 | #include <linux/uio.h> |
13 | #include <asm/byteorder.h> | 13 | #include <asm/byteorder.h> |
14 | #include <linux/scatterlist.h> | 14 | #include <linux/scatterlist.h> |
15 | #include <linux/smp_lock.h> | ||
15 | 16 | ||
16 | /* | 17 | /* |
17 | * Buffer adjustment | 18 | * Buffer adjustment |
@@ -36,6 +37,21 @@ struct xdr_netobj { | |||
36 | typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj); | 37 | typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj); |
37 | 38 | ||
38 | /* | 39 | /* |
40 | * We're still requiring the BKL in the xdr code until it's been | ||
41 | * more carefully audited, at which point this wrapper will become | ||
42 | * unnecessary. | ||
43 | */ | ||
44 | static inline int rpc_call_xdrproc(kxdrproc_t xdrproc, void *rqstp, __be32 *data, void *obj) | ||
45 | { | ||
46 | int ret; | ||
47 | |||
48 | lock_kernel(); | ||
49 | ret = xdrproc(rqstp, data, obj); | ||
50 | unlock_kernel(); | ||
51 | return ret; | ||
52 | } | ||
53 | |||
54 | /* | ||
39 | * Basic structure for transmission/reception of a client XDR message. | 55 | * Basic structure for transmission/reception of a client XDR message. |
40 | * Features a header (for a linear buffer containing RPC headers | 56 | * Features a header (for a linear buffer containing RPC headers |
41 | * and the data payload for short messages), and then an array of | 57 | * and the data payload for short messages), and then an array of |