Commit e354d571 authored by Andy Adamson's avatar Andy Adamson Committed by J. Bruce Fields

nfsd: embed nfsd4_current_state in nfsd4_compoundres

Remove the allocation of struct nfsd4_compound_state.
Signed-off-by: default avatarAndy Adamson <andros@netapp.com>
Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
parent 42d671c7
...@@ -809,29 +809,6 @@ static inline void nfsd4_increment_op_stats(u32 opnum) ...@@ -809,29 +809,6 @@ static inline void nfsd4_increment_op_stats(u32 opnum)
nfsdstats.nfs4_opcount[opnum]++; nfsdstats.nfs4_opcount[opnum]++;
} }
static void cstate_free(struct nfsd4_compound_state *cstate)
{
if (cstate == NULL)
return;
fh_put(&cstate->current_fh);
fh_put(&cstate->save_fh);
BUG_ON(cstate->replay_owner);
kfree(cstate);
}
static struct nfsd4_compound_state *cstate_alloc(void)
{
struct nfsd4_compound_state *cstate;
cstate = kmalloc(sizeof(struct nfsd4_compound_state), GFP_KERNEL);
if (cstate == NULL)
return NULL;
fh_init(&cstate->current_fh, NFS4_FHSIZE);
fh_init(&cstate->save_fh, NFS4_FHSIZE);
cstate->replay_owner = NULL;
return cstate;
}
typedef __be32(*nfsd4op_func)(struct svc_rqst *, struct nfsd4_compound_state *, typedef __be32(*nfsd4op_func)(struct svc_rqst *, struct nfsd4_compound_state *,
void *); void *);
...@@ -859,12 +836,13 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, ...@@ -859,12 +836,13 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
{ {
struct nfsd4_op *op; struct nfsd4_op *op;
struct nfsd4_operation *opdesc; struct nfsd4_operation *opdesc;
struct nfsd4_compound_state *cstate = NULL; struct nfsd4_compound_state *cstate = &resp->cstate;
int slack_bytes; int slack_bytes;
__be32 status; __be32 status;
resp->xbuf = &rqstp->rq_res; resp->xbuf = &rqstp->rq_res;
resp->p = rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len; resp->p = rqstp->rq_res.head[0].iov_base +
rqstp->rq_res.head[0].iov_len;
resp->tagp = resp->p; resp->tagp = resp->p;
/* reserve space for: taglen, tag, and opcnt */ /* reserve space for: taglen, tag, and opcnt */
resp->p += 2 + XDR_QUADLEN(args->taglen); resp->p += 2 + XDR_QUADLEN(args->taglen);
...@@ -873,6 +851,9 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, ...@@ -873,6 +851,9 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
resp->tag = args->tag; resp->tag = args->tag;
resp->opcnt = 0; resp->opcnt = 0;
resp->rqstp = rqstp; resp->rqstp = rqstp;
resp->cstate.replay_owner = NULL;
fh_init(&resp->cstate.current_fh, NFS4_FHSIZE);
fh_init(&resp->cstate.save_fh, NFS4_FHSIZE);
/* /*
* According to RFC3010, this takes precedence over all other errors. * According to RFC3010, this takes precedence over all other errors.
...@@ -881,11 +862,6 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, ...@@ -881,11 +862,6 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
if (args->minorversion > NFSD_SUPPORTED_MINOR_VERSION) if (args->minorversion > NFSD_SUPPORTED_MINOR_VERSION)
goto out; goto out;
status = nfserr_resource;
cstate = cstate_alloc();
if (cstate == NULL)
goto out;
status = nfs_ok; status = nfs_ok;
while (!status && resp->opcnt < args->opcnt) { while (!status && resp->opcnt < args->opcnt) {
op = &args->ops[resp->opcnt++]; op = &args->ops[resp->opcnt++];
...@@ -958,7 +934,9 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, ...@@ -958,7 +934,9 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
nfsd4_increment_op_stats(op->opnum); nfsd4_increment_op_stats(op->opnum);
} }
cstate_free(cstate); fh_put(&resp->cstate.current_fh);
fh_put(&resp->cstate.save_fh);
BUG_ON(resp->cstate.replay_owner);
out: out:
nfsd4_release_compoundargs(args); nfsd4_release_compoundargs(args);
dprintk("nfsv4 compound returned %d\n", ntohl(status)); dprintk("nfsv4 compound returned %d\n", ntohl(status));
......
...@@ -45,9 +45,9 @@ ...@@ -45,9 +45,9 @@
#define XDR_LEN(n) (((n) + 3) & ~3) #define XDR_LEN(n) (((n) + 3) & ~3)
struct nfsd4_compound_state { struct nfsd4_compound_state {
struct svc_fh current_fh; struct svc_fh current_fh;
struct svc_fh save_fh; struct svc_fh save_fh;
struct nfs4_stateowner *replay_owner; struct nfs4_stateowner *replay_owner;
}; };
struct nfsd4_change_info { struct nfsd4_change_info {
...@@ -416,7 +416,8 @@ struct nfsd4_compoundres { ...@@ -416,7 +416,8 @@ struct nfsd4_compoundres {
u32 taglen; u32 taglen;
char * tag; char * tag;
u32 opcnt; u32 opcnt;
__be32 * tagp; /* where to encode tag and opcount */ __be32 * tagp; /* tag, opcount encode location */
struct nfsd4_compound_state cstate;
}; };
#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) #define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment