NFSD: Encoder and decoder functions are always present
nfsd_dispatch() is a hot path. Let's optimize the XDR method calls for the by-far common case, which is that the XDR methods are indeed present. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
parent
ba1df797e5
commit
dcc46991d3
|
@ -183,6 +183,11 @@ static __be32 nfsacld_proc_access(struct svc_rqst *rqstp)
|
|||
/*
|
||||
* XDR decode functions
|
||||
*/
|
||||
static int nfsaclsvc_decode_voidarg(struct svc_rqst *rqstp, __be32 *p)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p)
|
||||
{
|
||||
struct nfsd3_getaclargs *argp = rqstp->rq_argp;
|
||||
|
@ -357,6 +362,7 @@ struct nfsd3_voidargs { int dummy; };
|
|||
static const struct svc_procedure nfsd_acl_procedures2[5] = {
|
||||
[ACLPROC2_NULL] = {
|
||||
.pc_func = nfsacld_proc_null,
|
||||
.pc_decode = nfsaclsvc_decode_voidarg,
|
||||
.pc_encode = nfsaclsvc_encode_voidres,
|
||||
.pc_argsize = sizeof(struct nfsd3_voidargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_voidargs),
|
||||
|
|
|
@ -245,6 +245,7 @@ struct nfsd3_voidargs { int dummy; };
|
|||
static const struct svc_procedure nfsd_acl_procedures3[3] = {
|
||||
[ACLPROC3_NULL] = {
|
||||
.pc_func = nfsd3_proc_null,
|
||||
.pc_decode = nfs3svc_decode_voidarg,
|
||||
.pc_encode = nfs3svc_encode_voidres,
|
||||
.pc_argsize = sizeof(struct nfsd3_voidargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_voidargs),
|
||||
|
|
|
@ -716,6 +716,7 @@ struct nfsd3_voidargs { int dummy; };
|
|||
static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
[NFS3PROC_NULL] = {
|
||||
.pc_func = nfsd3_proc_null,
|
||||
.pc_decode = nfs3svc_decode_voidarg,
|
||||
.pc_encode = nfs3svc_encode_voidres,
|
||||
.pc_argsize = sizeof(struct nfsd3_voidargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_voidres),
|
||||
|
|
|
@ -304,6 +304,12 @@ void fill_post_wcc(struct svc_fh *fhp)
|
|||
/*
|
||||
* XDR decode functions
|
||||
*/
|
||||
int
|
||||
nfs3svc_decode_voidarg(struct svc_rqst *rqstp, __be32 *p)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
nfs3svc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p)
|
||||
{
|
||||
|
|
|
@ -3279,6 +3279,7 @@ struct nfsd4_voidargs { int dummy; };
|
|||
static const struct svc_procedure nfsd_procedures4[2] = {
|
||||
[NFSPROC4_NULL] = {
|
||||
.pc_func = nfsd4_proc_null,
|
||||
.pc_decode = nfs4svc_decode_voidarg,
|
||||
.pc_encode = nfs4svc_encode_voidres,
|
||||
.pc_argsize = sizeof(struct nfsd4_voidargs),
|
||||
.pc_ressize = sizeof(struct nfsd4_voidres),
|
||||
|
|
|
@ -5134,6 +5134,12 @@ void nfsd4_release_compoundargs(struct svc_rqst *rqstp)
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
nfs4svc_decode_voidarg(struct svc_rqst *rqstp, __be32 *p)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, __be32 *p)
|
||||
{
|
||||
|
|
|
@ -1022,8 +1022,7 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
|
|||
*/
|
||||
rqstp->rq_cachetype = proc->pc_cachetype;
|
||||
/* Decode arguments */
|
||||
if (proc->pc_decode &&
|
||||
!proc->pc_decode(rqstp, (__be32*)rqstp->rq_arg.head[0].iov_base)) {
|
||||
if (!proc->pc_decode(rqstp, (__be32 *)rqstp->rq_arg.head[0].iov_base)) {
|
||||
dprintk("nfsd: failed to decode arguments!\n");
|
||||
*statp = rpc_garbage_args;
|
||||
return 1;
|
||||
|
@ -1062,7 +1061,7 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
|
|||
* For NFSv2, additional info is never returned in case of an error.
|
||||
*/
|
||||
if (!(nfserr && rqstp->rq_vers == 2)) {
|
||||
if (proc->pc_encode && !proc->pc_encode(rqstp, nfserrp)) {
|
||||
if (!proc->pc_encode(rqstp, nfserrp)) {
|
||||
/* Failed to encode result. Release cache entry */
|
||||
dprintk("nfsd: failed to encode result!\n");
|
||||
nfsd_cache_update(rqstp, RC_NOCACHE, NULL);
|
||||
|
|
|
@ -273,6 +273,7 @@ union nfsd3_xdrstore {
|
|||
|
||||
#define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore)
|
||||
|
||||
int nfs3svc_decode_voidarg(struct svc_rqst *, __be32 *);
|
||||
int nfs3svc_decode_fhandle(struct svc_rqst *, __be32 *);
|
||||
int nfs3svc_decode_sattrargs(struct svc_rqst *, __be32 *);
|
||||
int nfs3svc_decode_diropargs(struct svc_rqst *, __be32 *);
|
||||
|
|
|
@ -781,6 +781,7 @@ set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
|
|||
|
||||
|
||||
bool nfsd4_mach_creds_match(struct nfs4_client *cl, struct svc_rqst *rqstp);
|
||||
int nfs4svc_decode_voidarg(struct svc_rqst *, __be32 *);
|
||||
int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *);
|
||||
int nfs4svc_decode_compoundargs(struct svc_rqst *, __be32 *);
|
||||
int nfs4svc_encode_compoundres(struct svc_rqst *, __be32 *);
|
||||
|
|
Loading…
Reference in New Issue
Block a user