aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs3xdr.c
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2008-03-31 10:39:06 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-04-19 16:54:47 -0400
commit856dff3d3875bdc8b88e4a65779873af76776a69 (patch)
tree03f10cfa3319df59987fa20b1e96902d96fdb4ee /fs/nfs/nfs3xdr.c
parentd11d10cc05c94a32632d6928d15a1034200dd9a5 (diff)
nfs: return negative error value from nfs{,4}_stat_to_errno
All use sites for nfs{,4}_stat_to_errno negate their return value. It's more efficient to return a negative error from the stat_to_errno convertors rather than negating its return value everywhere. This also produces slightly smaller code. Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs3xdr.c')
-rw-r--r--fs/nfs/nfs3xdr.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
index fb03048ac650..11cdddec1432 100644
--- a/fs/nfs/nfs3xdr.c
+++ b/fs/nfs/nfs3xdr.c
@@ -515,7 +515,7 @@ nfs3_xdr_readdirres(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirres *res
515 /* Decode post_op_attrs */ 515 /* Decode post_op_attrs */
516 p = xdr_decode_post_op_attr(p, res->dir_attr); 516 p = xdr_decode_post_op_attr(p, res->dir_attr);
517 if (status) 517 if (status)
518 return -nfs_stat_to_errno(status); 518 return nfs_stat_to_errno(status);
519 /* Decode verifier cookie */ 519 /* Decode verifier cookie */
520 if (res->verf) { 520 if (res->verf) {
521 res->verf[0] = *p++; 521 res->verf[0] = *p++;
@@ -751,7 +751,7 @@ nfs3_xdr_attrstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
751 int status; 751 int status;
752 752
753 if ((status = ntohl(*p++))) 753 if ((status = ntohl(*p++)))
754 return -nfs_stat_to_errno(status); 754 return nfs_stat_to_errno(status);
755 xdr_decode_fattr(p, fattr); 755 xdr_decode_fattr(p, fattr);
756 return 0; 756 return 0;
757} 757}
@@ -766,7 +766,7 @@ nfs3_xdr_wccstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
766 int status; 766 int status;
767 767
768 if ((status = ntohl(*p++))) 768 if ((status = ntohl(*p++)))
769 status = -nfs_stat_to_errno(status); 769 status = nfs_stat_to_errno(status);
770 xdr_decode_wcc_data(p, fattr); 770 xdr_decode_wcc_data(p, fattr);
771 return status; 771 return status;
772} 772}
@@ -786,7 +786,7 @@ nfs3_xdr_lookupres(struct rpc_rqst *req, __be32 *p, struct nfs3_diropres *res)
786 int status; 786 int status;
787 787
788 if ((status = ntohl(*p++))) { 788 if ((status = ntohl(*p++))) {
789 status = -nfs_stat_to_errno(status); 789 status = nfs_stat_to_errno(status);
790 } else { 790 } else {
791 if (!(p = xdr_decode_fhandle(p, res->fh))) 791 if (!(p = xdr_decode_fhandle(p, res->fh)))
792 return -errno_NFSERR_IO; 792 return -errno_NFSERR_IO;
@@ -806,7 +806,7 @@ nfs3_xdr_accessres(struct rpc_rqst *req, __be32 *p, struct nfs3_accessres *res)
806 806
807 p = xdr_decode_post_op_attr(p, res->fattr); 807 p = xdr_decode_post_op_attr(p, res->fattr);
808 if (status) 808 if (status)
809 return -nfs_stat_to_errno(status); 809 return nfs_stat_to_errno(status);
810 res->access = ntohl(*p++); 810 res->access = ntohl(*p++);
811 return 0; 811 return 0;
812} 812}
@@ -843,7 +843,7 @@ nfs3_xdr_readlinkres(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
843 p = xdr_decode_post_op_attr(p, fattr); 843 p = xdr_decode_post_op_attr(p, fattr);
844 844
845 if (status != 0) 845 if (status != 0)
846 return -nfs_stat_to_errno(status); 846 return nfs_stat_to_errno(status);
847 847
848 /* Convert length of symlink */ 848 /* Convert length of symlink */
849 len = ntohl(*p++); 849 len = ntohl(*p++);
@@ -891,7 +891,7 @@ nfs3_xdr_readres(struct rpc_rqst *req, __be32 *p, struct nfs_readres *res)
891 p = xdr_decode_post_op_attr(p, res->fattr); 891 p = xdr_decode_post_op_attr(p, res->fattr);
892 892
893 if (status != 0) 893 if (status != 0)
894 return -nfs_stat_to_errno(status); 894 return nfs_stat_to_errno(status);
895 895
896 /* Decode reply count and EOF flag. NFSv3 is somewhat redundant 896 /* Decode reply count and EOF flag. NFSv3 is somewhat redundant
897 * in that it puts the count both in the res struct and in the 897 * in that it puts the count both in the res struct and in the
@@ -941,7 +941,7 @@ nfs3_xdr_writeres(struct rpc_rqst *req, __be32 *p, struct nfs_writeres *res)
941 p = xdr_decode_wcc_data(p, res->fattr); 941 p = xdr_decode_wcc_data(p, res->fattr);
942 942
943 if (status != 0) 943 if (status != 0)
944 return -nfs_stat_to_errno(status); 944 return nfs_stat_to_errno(status);
945 945
946 res->count = ntohl(*p++); 946 res->count = ntohl(*p++);
947 res->verf->committed = (enum nfs3_stable_how)ntohl(*p++); 947 res->verf->committed = (enum nfs3_stable_how)ntohl(*p++);
@@ -972,7 +972,7 @@ nfs3_xdr_createres(struct rpc_rqst *req, __be32 *p, struct nfs3_diropres *res)
972 res->fattr->valid = 0; 972 res->fattr->valid = 0;
973 } 973 }
974 } else { 974 } else {
975 status = -nfs_stat_to_errno(status); 975 status = nfs_stat_to_errno(status);
976 } 976 }
977 p = xdr_decode_wcc_data(p, res->dir_attr); 977 p = xdr_decode_wcc_data(p, res->dir_attr);
978 return status; 978 return status;
@@ -987,7 +987,7 @@ nfs3_xdr_renameres(struct rpc_rqst *req, __be32 *p, struct nfs3_renameres *res)
987 int status; 987 int status;
988 988
989 if ((status = ntohl(*p++)) != 0) 989 if ((status = ntohl(*p++)) != 0)
990 status = -nfs_stat_to_errno(status); 990 status = nfs_stat_to_errno(status);
991 p = xdr_decode_wcc_data(p, res->fromattr); 991 p = xdr_decode_wcc_data(p, res->fromattr);
992 p = xdr_decode_wcc_data(p, res->toattr); 992 p = xdr_decode_wcc_data(p, res->toattr);
993 return status; 993 return status;
@@ -1002,7 +1002,7 @@ nfs3_xdr_linkres(struct rpc_rqst *req, __be32 *p, struct nfs3_linkres *res)
1002 int status; 1002 int status;
1003 1003
1004 if ((status = ntohl(*p++)) != 0) 1004 if ((status = ntohl(*p++)) != 0)
1005 status = -nfs_stat_to_errno(status); 1005 status = nfs_stat_to_errno(status);
1006 p = xdr_decode_post_op_attr(p, res->fattr); 1006 p = xdr_decode_post_op_attr(p, res->fattr);
1007 p = xdr_decode_wcc_data(p, res->dir_attr); 1007 p = xdr_decode_wcc_data(p, res->dir_attr);
1008 return status; 1008 return status;
@@ -1020,7 +1020,7 @@ nfs3_xdr_fsstatres(struct rpc_rqst *req, __be32 *p, struct nfs_fsstat *res)
1020 1020
1021 p = xdr_decode_post_op_attr(p, res->fattr); 1021 p = xdr_decode_post_op_attr(p, res->fattr);
1022 if (status != 0) 1022 if (status != 0)
1023 return -nfs_stat_to_errno(status); 1023 return nfs_stat_to_errno(status);
1024 1024
1025 p = xdr_decode_hyper(p, &res->tbytes); 1025 p = xdr_decode_hyper(p, &res->tbytes);
1026 p = xdr_decode_hyper(p, &res->fbytes); 1026 p = xdr_decode_hyper(p, &res->fbytes);
@@ -1045,7 +1045,7 @@ nfs3_xdr_fsinfores(struct rpc_rqst *req, __be32 *p, struct nfs_fsinfo *res)
1045 1045
1046 p = xdr_decode_post_op_attr(p, res->fattr); 1046 p = xdr_decode_post_op_attr(p, res->fattr);
1047 if (status != 0) 1047 if (status != 0)
1048 return -nfs_stat_to_errno(status); 1048 return nfs_stat_to_errno(status);
1049 1049
1050 res->rtmax = ntohl(*p++); 1050 res->rtmax = ntohl(*p++);
1051 res->rtpref = ntohl(*p++); 1051 res->rtpref = ntohl(*p++);
@@ -1073,7 +1073,7 @@ nfs3_xdr_pathconfres(struct rpc_rqst *req, __be32 *p, struct nfs_pathconf *res)
1073 1073
1074 p = xdr_decode_post_op_attr(p, res->fattr); 1074 p = xdr_decode_post_op_attr(p, res->fattr);
1075 if (status != 0) 1075 if (status != 0)
1076 return -nfs_stat_to_errno(status); 1076 return nfs_stat_to_errno(status);
1077 res->max_link = ntohl(*p++); 1077 res->max_link = ntohl(*p++);
1078 res->max_namelen = ntohl(*p++); 1078 res->max_namelen = ntohl(*p++);
1079 1079
@@ -1092,7 +1092,7 @@ nfs3_xdr_commitres(struct rpc_rqst *req, __be32 *p, struct nfs_writeres *res)
1092 status = ntohl(*p++); 1092 status = ntohl(*p++);
1093 p = xdr_decode_wcc_data(p, res->fattr); 1093 p = xdr_decode_wcc_data(p, res->fattr);
1094 if (status != 0) 1094 if (status != 0)
1095 return -nfs_stat_to_errno(status); 1095 return nfs_stat_to_errno(status);
1096 1096
1097 res->verf->verifier[0] = *p++; 1097 res->verf->verifier[0] = *p++;
1098 res->verf->verifier[1] = *p++; 1098 res->verf->verifier[1] = *p++;
@@ -1114,7 +1114,7 @@ nfs3_xdr_getaclres(struct rpc_rqst *req, __be32 *p,
1114 int err, base; 1114 int err, base;
1115 1115
1116 if (status != 0) 1116 if (status != 0)
1117 return -nfs_stat_to_errno(status); 1117 return nfs_stat_to_errno(status);
1118 p = xdr_decode_post_op_attr(p, res->fattr); 1118 p = xdr_decode_post_op_attr(p, res->fattr);
1119 res->mask = ntohl(*p++); 1119 res->mask = ntohl(*p++);
1120 if (res->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) 1120 if (res->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT))
@@ -1141,7 +1141,7 @@ nfs3_xdr_setaclres(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
1141 int status = ntohl(*p++); 1141 int status = ntohl(*p++);
1142 1142
1143 if (status) 1143 if (status)
1144 return -nfs_stat_to_errno(status); 1144 return nfs_stat_to_errno(status);
1145 xdr_decode_post_op_attr(p, fattr); 1145 xdr_decode_post_op_attr(p, fattr);
1146 return 0; 1146 return 0;
1147} 1147}