aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-04-27 13:48:18 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-05-01 15:42:43 -0400
commit90ff0c548d1220d31f80e498b587393895705e6c (patch)
treecb3b1f54071764034304c4c35440ca12235e4b20
parentfee7fe196c41847c135cde41b0ec790f53ee6fcf (diff)
NFSv4: Simplify the NFSv4 OPEN compound
Get rid of the post-op GETATTR on the directory in order to reduce the amount of processing done on the server. The cost is that if we later need to stat() the directory, then we know that the ctime and mtime are likely to be invalid. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/nfs4proc.c11
-rw-r--r--fs/nfs/nfs4xdr.c18
-rw-r--r--include/linux/nfs_xdr.h2
3 files changed, 2 insertions, 29 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 2e0fbff37d1f..f01c3d1b54b7 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -788,7 +788,6 @@ struct nfs4_opendata {
788 struct nfs4_string owner_name; 788 struct nfs4_string owner_name;
789 struct nfs4_string group_name; 789 struct nfs4_string group_name;
790 struct nfs_fattr f_attr; 790 struct nfs_fattr f_attr;
791 struct nfs_fattr dir_attr;
792 struct dentry *dir; 791 struct dentry *dir;
793 struct dentry *dentry; 792 struct dentry *dentry;
794 struct nfs4_state_owner *owner; 793 struct nfs4_state_owner *owner;
@@ -804,12 +803,10 @@ struct nfs4_opendata {
804static void nfs4_init_opendata_res(struct nfs4_opendata *p) 803static void nfs4_init_opendata_res(struct nfs4_opendata *p)
805{ 804{
806 p->o_res.f_attr = &p->f_attr; 805 p->o_res.f_attr = &p->f_attr;
807 p->o_res.dir_attr = &p->dir_attr;
808 p->o_res.seqid = p->o_arg.seqid; 806 p->o_res.seqid = p->o_arg.seqid;
809 p->c_res.seqid = p->c_arg.seqid; 807 p->c_res.seqid = p->c_arg.seqid;
810 p->o_res.server = p->o_arg.server; 808 p->o_res.server = p->o_arg.server;
811 nfs_fattr_init(&p->f_attr); 809 nfs_fattr_init(&p->f_attr);
812 nfs_fattr_init(&p->dir_attr);
813 nfs_fattr_init_names(&p->f_attr, &p->owner_name, &p->group_name); 810 nfs_fattr_init_names(&p->f_attr, &p->owner_name, &p->group_name);
814} 811}
815 812
@@ -843,7 +840,6 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry,
843 p->o_arg.name = &dentry->d_name; 840 p->o_arg.name = &dentry->d_name;
844 p->o_arg.server = server; 841 p->o_arg.server = server;
845 p->o_arg.bitmask = server->attr_bitmask; 842 p->o_arg.bitmask = server->attr_bitmask;
846 p->o_arg.dir_bitmask = server->cache_consistency_bitmask;
847 p->o_arg.claim = NFS4_OPEN_CLAIM_NULL; 843 p->o_arg.claim = NFS4_OPEN_CLAIM_NULL;
848 if (attrs != NULL && attrs->ia_valid != 0) { 844 if (attrs != NULL && attrs->ia_valid != 0) {
849 __be32 verf[2]; 845 __be32 verf[2];
@@ -1611,8 +1607,6 @@ static int _nfs4_recover_proc_open(struct nfs4_opendata *data)
1611 1607
1612 nfs_fattr_map_and_free_names(NFS_SERVER(dir), &data->f_attr); 1608 nfs_fattr_map_and_free_names(NFS_SERVER(dir), &data->f_attr);
1613 1609
1614 nfs_refresh_inode(dir, o_res->dir_attr);
1615
1616 if (o_res->rflags & NFS4_OPEN_RESULT_CONFIRM) { 1610 if (o_res->rflags & NFS4_OPEN_RESULT_CONFIRM) {
1617 status = _nfs4_proc_open_confirm(data); 1611 status = _nfs4_proc_open_confirm(data);
1618 if (status != 0) 1612 if (status != 0)
@@ -1645,11 +1639,8 @@ static int _nfs4_proc_open(struct nfs4_opendata *data)
1645 1639
1646 nfs_fattr_map_and_free_names(server, &data->f_attr); 1640 nfs_fattr_map_and_free_names(server, &data->f_attr);
1647 1641
1648 if (o_arg->open_flags & O_CREAT) { 1642 if (o_arg->open_flags & O_CREAT)
1649 update_changeattr(dir, &o_res->cinfo); 1643 update_changeattr(dir, &o_res->cinfo);
1650 nfs_post_op_update_inode(dir, o_res->dir_attr);
1651 } else
1652 nfs_refresh_inode(dir, o_res->dir_attr);
1653 if ((o_res->rflags & NFS4_OPEN_RESULT_LOCKTYPE_POSIX) == 0) 1644 if ((o_res->rflags & NFS4_OPEN_RESULT_LOCKTYPE_POSIX) == 0)
1654 server->caps &= ~NFS_CAP_POSIX_LOCK; 1645 server->caps &= ~NFS_CAP_POSIX_LOCK;
1655 if(o_res->rflags & NFS4_OPEN_RESULT_CONFIRM) { 1646 if(o_res->rflags & NFS4_OPEN_RESULT_CONFIRM) {
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index ac7a3b014d99..6e878dcc0d2d 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -431,20 +431,14 @@ static int nfs4_stat_to_errno(int);
431#define NFS4_enc_open_sz (compound_encode_hdr_maxsz + \ 431#define NFS4_enc_open_sz (compound_encode_hdr_maxsz + \
432 encode_sequence_maxsz + \ 432 encode_sequence_maxsz + \
433 encode_putfh_maxsz + \ 433 encode_putfh_maxsz + \
434 encode_savefh_maxsz + \
435 encode_open_maxsz + \ 434 encode_open_maxsz + \
436 encode_getfh_maxsz + \ 435 encode_getfh_maxsz + \
437 encode_getattr_maxsz + \
438 encode_restorefh_maxsz + \
439 encode_getattr_maxsz) 436 encode_getattr_maxsz)
440#define NFS4_dec_open_sz (compound_decode_hdr_maxsz + \ 437#define NFS4_dec_open_sz (compound_decode_hdr_maxsz + \
441 decode_sequence_maxsz + \ 438 decode_sequence_maxsz + \
442 decode_putfh_maxsz + \ 439 decode_putfh_maxsz + \
443 decode_savefh_maxsz + \
444 decode_open_maxsz + \ 440 decode_open_maxsz + \
445 decode_getfh_maxsz + \ 441 decode_getfh_maxsz + \
446 decode_getattr_maxsz + \
447 decode_restorefh_maxsz + \
448 decode_getattr_maxsz) 442 decode_getattr_maxsz)
449#define NFS4_enc_open_confirm_sz \ 443#define NFS4_enc_open_confirm_sz \
450 (compound_encode_hdr_maxsz + \ 444 (compound_encode_hdr_maxsz + \
@@ -2191,12 +2185,9 @@ static void nfs4_xdr_enc_open(struct rpc_rqst *req, struct xdr_stream *xdr,
2191 encode_compound_hdr(xdr, req, &hdr); 2185 encode_compound_hdr(xdr, req, &hdr);
2192 encode_sequence(xdr, &args->seq_args, &hdr); 2186 encode_sequence(xdr, &args->seq_args, &hdr);
2193 encode_putfh(xdr, args->fh, &hdr); 2187 encode_putfh(xdr, args->fh, &hdr);
2194 encode_savefh(xdr, &hdr);
2195 encode_open(xdr, args, &hdr); 2188 encode_open(xdr, args, &hdr);
2196 encode_getfh(xdr, &hdr); 2189 encode_getfh(xdr, &hdr);
2197 encode_getfattr(xdr, args->bitmask, &hdr); 2190 encode_getfattr(xdr, args->bitmask, &hdr);
2198 encode_restorefh(xdr, &hdr);
2199 encode_getfattr(xdr, args->dir_bitmask, &hdr);
2200 encode_nops(&hdr); 2191 encode_nops(&hdr);
2201} 2192}
2202 2193
@@ -6075,19 +6066,12 @@ static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6075 status = decode_putfh(xdr); 6066 status = decode_putfh(xdr);
6076 if (status) 6067 if (status)
6077 goto out; 6068 goto out;
6078 status = decode_savefh(xdr);
6079 if (status)
6080 goto out;
6081 status = decode_open(xdr, res); 6069 status = decode_open(xdr, res);
6082 if (status) 6070 if (status)
6083 goto out; 6071 goto out;
6084 if (decode_getfh(xdr, &res->fh) != 0) 6072 if (decode_getfh(xdr, &res->fh) != 0)
6085 goto out; 6073 goto out;
6086 if (decode_getfattr(xdr, res->f_attr, res->server) != 0) 6074 decode_getfattr(xdr, res->f_attr, res->server);
6087 goto out;
6088 if (decode_restorefh(xdr) != 0)
6089 goto out;
6090 decode_getfattr(xdr, res->dir_attr, res->server);
6091out: 6075out:
6092 return status; 6076 return status;
6093} 6077}
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index bc3680885428..92a929fc97c8 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -338,7 +338,6 @@ struct nfs_openargs {
338 const struct qstr * name; 338 const struct qstr * name;
339 const struct nfs_server *server; /* Needed for ID mapping */ 339 const struct nfs_server *server; /* Needed for ID mapping */
340 const u32 * bitmask; 340 const u32 * bitmask;
341 const u32 * dir_bitmask;
342 __u32 claim; 341 __u32 claim;
343 struct nfs4_sequence_args seq_args; 342 struct nfs4_sequence_args seq_args;
344}; 343};
@@ -349,7 +348,6 @@ struct nfs_openres {
349 struct nfs4_change_info cinfo; 348 struct nfs4_change_info cinfo;
350 __u32 rflags; 349 __u32 rflags;
351 struct nfs_fattr * f_attr; 350 struct nfs_fattr * f_attr;
352 struct nfs_fattr * dir_attr;
353 struct nfs_seqid * seqid; 351 struct nfs_seqid * seqid;
354 const struct nfs_server *server; 352 const struct nfs_server *server;
355 fmode_t delegation_type; 353 fmode_t delegation_type;