NFSv4: Simplify the NFSv4 CREATE compound

Get rid of the post-op GETATTR on the directory in order to reduce
the amount of processing done on the server.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
Trond Myklebust 2012-04-27 13:48:18 -04:00
parent 90ff0c548d
commit 7c317fcfba
3 changed files with 1 additions and 23 deletions

View file

@ -2994,7 +2994,6 @@ struct nfs4_createdata {
struct nfs4_create_res res; struct nfs4_create_res res;
struct nfs_fh fh; struct nfs_fh fh;
struct nfs_fattr fattr; struct nfs_fattr fattr;
struct nfs_fattr dir_fattr;
}; };
static struct nfs4_createdata *nfs4_alloc_createdata(struct inode *dir, static struct nfs4_createdata *nfs4_alloc_createdata(struct inode *dir,
@ -3018,9 +3017,7 @@ static struct nfs4_createdata *nfs4_alloc_createdata(struct inode *dir,
data->res.server = server; data->res.server = server;
data->res.fh = &data->fh; data->res.fh = &data->fh;
data->res.fattr = &data->fattr; data->res.fattr = &data->fattr;
data->res.dir_fattr = &data->dir_fattr;
nfs_fattr_init(data->res.fattr); nfs_fattr_init(data->res.fattr);
nfs_fattr_init(data->res.dir_fattr);
} }
return data; return data;
} }
@ -3031,7 +3028,6 @@ static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_
&data->arg.seq_args, &data->res.seq_res, 1); &data->arg.seq_args, &data->res.seq_res, 1);
if (status == 0) { if (status == 0) {
update_changeattr(dir, &data->res.dir_cinfo); update_changeattr(dir, &data->res.dir_cinfo);
nfs_post_op_update_inode(dir, data->res.dir_fattr);
status = nfs_instantiate(dentry, data->res.fh, data->res.fattr); status = nfs_instantiate(dentry, data->res.fh, data->res.fattr);
} }
return status; return status;

View file

@ -647,20 +647,14 @@ static int nfs4_stat_to_errno(int);
#define NFS4_enc_create_sz (compound_encode_hdr_maxsz + \ #define NFS4_enc_create_sz (compound_encode_hdr_maxsz + \
encode_sequence_maxsz + \ encode_sequence_maxsz + \
encode_putfh_maxsz + \ encode_putfh_maxsz + \
encode_savefh_maxsz + \
encode_create_maxsz + \ encode_create_maxsz + \
encode_getfh_maxsz + \ encode_getfh_maxsz + \
encode_getattr_maxsz + \
encode_restorefh_maxsz + \
encode_getattr_maxsz) encode_getattr_maxsz)
#define NFS4_dec_create_sz (compound_decode_hdr_maxsz + \ #define NFS4_dec_create_sz (compound_decode_hdr_maxsz + \
decode_sequence_maxsz + \ decode_sequence_maxsz + \
decode_putfh_maxsz + \ decode_putfh_maxsz + \
decode_savefh_maxsz + \
decode_create_maxsz + \ decode_create_maxsz + \
decode_getfh_maxsz + \ decode_getfh_maxsz + \
decode_getattr_maxsz + \
decode_restorefh_maxsz + \
decode_getattr_maxsz) decode_getattr_maxsz)
#define NFS4_enc_pathconf_sz (compound_encode_hdr_maxsz + \ #define NFS4_enc_pathconf_sz (compound_encode_hdr_maxsz + \
encode_sequence_maxsz + \ encode_sequence_maxsz + \
@ -2119,12 +2113,9 @@ static void nfs4_xdr_enc_create(struct rpc_rqst *req, struct xdr_stream *xdr,
encode_compound_hdr(xdr, req, &hdr); encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr); encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->dir_fh, &hdr); encode_putfh(xdr, args->dir_fh, &hdr);
encode_savefh(xdr, &hdr);
encode_create(xdr, args, &hdr); encode_create(xdr, args, &hdr);
encode_getfh(xdr, &hdr); encode_getfh(xdr, &hdr);
encode_getfattr(xdr, args->bitmask, &hdr); encode_getfattr(xdr, args->bitmask, &hdr);
encode_restorefh(xdr, &hdr);
encode_getfattr(xdr, args->bitmask, &hdr);
encode_nops(&hdr); encode_nops(&hdr);
} }
@ -5893,9 +5884,6 @@ static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
if (status) if (status)
goto out; goto out;
status = decode_putfh(xdr); status = decode_putfh(xdr);
if (status)
goto out;
status = decode_savefh(xdr);
if (status) if (status)
goto out; goto out;
status = decode_create(xdr, &res->dir_cinfo); status = decode_create(xdr, &res->dir_cinfo);
@ -5904,12 +5892,7 @@ static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
status = decode_getfh(xdr, res->fh); status = decode_getfh(xdr, res->fh);
if (status) if (status)
goto out; goto out;
if (decode_getfattr(xdr, res->fattr, res->server)) decode_getfattr(xdr, res->fattr, res->server);
goto out;
status = decode_restorefh(xdr);
if (status)
goto out;
decode_getfattr(xdr, res->dir_fattr, res->server);
out: out:
return status; return status;
} }

View file

@ -855,7 +855,6 @@ struct nfs4_create_res {
struct nfs_fh * fh; struct nfs_fh * fh;
struct nfs_fattr * fattr; struct nfs_fattr * fattr;
struct nfs4_change_info dir_cinfo; struct nfs4_change_info dir_cinfo;
struct nfs_fattr * dir_fattr;
struct nfs4_sequence_res seq_res; struct nfs4_sequence_res seq_res;
}; };