aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2009-08-14 10:19:30 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-08-14 13:18:03 -0400
commit345585132a204859fbb7d8b662e9b6e5b563c6dc (patch)
tree12687faa2e42b5ccfdb02a3e8110884a92b50502 /fs
parent13c65ce90006badccd5663e558e3c85869ae5ce6 (diff)
nfs: nfs4xdr: optimize low level encoding
do not increment encoding ptr if not needed. Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4xdr.c128
1 files changed, 64 insertions, 64 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 3bcde49fbea8..d75f821cad01 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -737,7 +737,7 @@ static void encode_compound_hdr(struct xdr_stream *xdr,
737 p = xdr_encode_opaque_fixed(p, hdr->tag, hdr->taglen); 737 p = xdr_encode_opaque_fixed(p, hdr->tag, hdr->taglen);
738 *p++ = cpu_to_be32(hdr->minorversion); 738 *p++ = cpu_to_be32(hdr->minorversion);
739 hdr->nops_p = p; 739 hdr->nops_p = p;
740 *p++ = cpu_to_be32(hdr->nops); 740 *p = cpu_to_be32(hdr->nops);
741} 741}
742 742
743static void encode_nops(struct compound_hdr *hdr) 743static void encode_nops(struct compound_hdr *hdr)
@@ -874,7 +874,7 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const
874 len = (char *)p - (char *)q - 12; 874 len = (char *)p - (char *)q - 12;
875 *q++ = htonl(bmval0); 875 *q++ = htonl(bmval0);
876 *q++ = htonl(bmval1); 876 *q++ = htonl(bmval1);
877 *q++ = htonl(len); 877 *q = htonl(len);
878 878
879/* out: */ 879/* out: */
880} 880}
@@ -885,7 +885,7 @@ static void encode_access(struct xdr_stream *xdr, u32 access, struct compound_hd
885 885
886 p = reserve_space(xdr, 8); 886 p = reserve_space(xdr, 8);
887 *p++ = cpu_to_be32(OP_ACCESS); 887 *p++ = cpu_to_be32(OP_ACCESS);
888 *p++ = cpu_to_be32(access); 888 *p = cpu_to_be32(access);
889 hdr->nops++; 889 hdr->nops++;
890 hdr->replen += decode_access_maxsz; 890 hdr->replen += decode_access_maxsz;
891} 891}
@@ -897,7 +897,7 @@ static void encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg
897 p = reserve_space(xdr, 8+NFS4_STATEID_SIZE); 897 p = reserve_space(xdr, 8+NFS4_STATEID_SIZE);
898 *p++ = cpu_to_be32(OP_CLOSE); 898 *p++ = cpu_to_be32(OP_CLOSE);
899 *p++ = cpu_to_be32(arg->seqid->sequence->counter); 899 *p++ = cpu_to_be32(arg->seqid->sequence->counter);
900 p = xdr_encode_opaque_fixed(p, arg->stateid->data, NFS4_STATEID_SIZE); 900 xdr_encode_opaque_fixed(p, arg->stateid->data, NFS4_STATEID_SIZE);
901 hdr->nops++; 901 hdr->nops++;
902 hdr->replen += decode_close_maxsz; 902 hdr->replen += decode_close_maxsz;
903} 903}
@@ -909,7 +909,7 @@ static void encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *ar
909 p = reserve_space(xdr, 16); 909 p = reserve_space(xdr, 16);
910 *p++ = cpu_to_be32(OP_COMMIT); 910 *p++ = cpu_to_be32(OP_COMMIT);
911 p = xdr_encode_hyper(p, args->offset); 911 p = xdr_encode_hyper(p, args->offset);
912 *p++ = cpu_to_be32(args->count); 912 *p = cpu_to_be32(args->count);
913 hdr->nops++; 913 hdr->nops++;
914 hdr->replen += decode_commit_maxsz; 914 hdr->replen += decode_commit_maxsz;
915} 915}
@@ -920,19 +920,19 @@ static void encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *
920 920
921 p = reserve_space(xdr, 8); 921 p = reserve_space(xdr, 8);
922 *p++ = cpu_to_be32(OP_CREATE); 922 *p++ = cpu_to_be32(OP_CREATE);
923 *p++ = cpu_to_be32(create->ftype); 923 *p = cpu_to_be32(create->ftype);
924 924
925 switch (create->ftype) { 925 switch (create->ftype) {
926 case NF4LNK: 926 case NF4LNK:
927 p = reserve_space(xdr, 4); 927 p = reserve_space(xdr, 4);
928 *p++ = cpu_to_be32(create->u.symlink.len); 928 *p = cpu_to_be32(create->u.symlink.len);
929 xdr_write_pages(xdr, create->u.symlink.pages, 0, create->u.symlink.len); 929 xdr_write_pages(xdr, create->u.symlink.pages, 0, create->u.symlink.len);
930 break; 930 break;
931 931
932 case NF4BLK: case NF4CHR: 932 case NF4BLK: case NF4CHR:
933 p = reserve_space(xdr, 8); 933 p = reserve_space(xdr, 8);
934 *p++ = cpu_to_be32(create->u.device.specdata1); 934 *p++ = cpu_to_be32(create->u.device.specdata1);
935 *p++ = cpu_to_be32(create->u.device.specdata2); 935 *p = cpu_to_be32(create->u.device.specdata2);
936 break; 936 break;
937 937
938 default: 938 default:
@@ -941,7 +941,7 @@ static void encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *
941 941
942 p = reserve_space(xdr, 4 + create->name->len); 942 p = reserve_space(xdr, 4 + create->name->len);
943 *p++ = cpu_to_be32(create->name->len); 943 *p++ = cpu_to_be32(create->name->len);
944 p = xdr_encode_opaque_fixed(p, create->name->name, create->name->len); 944 xdr_encode_opaque_fixed(p, create->name->name, create->name->len);
945 hdr->nops++; 945 hdr->nops++;
946 hdr->replen += decode_create_maxsz; 946 hdr->replen += decode_create_maxsz;
947 947
@@ -955,7 +955,7 @@ static void encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap, struct c
955 p = reserve_space(xdr, 12); 955 p = reserve_space(xdr, 12);
956 *p++ = cpu_to_be32(OP_GETATTR); 956 *p++ = cpu_to_be32(OP_GETATTR);
957 *p++ = cpu_to_be32(1); 957 *p++ = cpu_to_be32(1);
958 *p++ = cpu_to_be32(bitmap); 958 *p = cpu_to_be32(bitmap);
959 hdr->nops++; 959 hdr->nops++;
960 hdr->replen += decode_getattr_maxsz; 960 hdr->replen += decode_getattr_maxsz;
961} 961}
@@ -968,7 +968,7 @@ static void encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0, uint32_t bm
968 *p++ = cpu_to_be32(OP_GETATTR); 968 *p++ = cpu_to_be32(OP_GETATTR);
969 *p++ = cpu_to_be32(2); 969 *p++ = cpu_to_be32(2);
970 *p++ = cpu_to_be32(bm0); 970 *p++ = cpu_to_be32(bm0);
971 *p++ = cpu_to_be32(bm1); 971 *p = cpu_to_be32(bm1);
972 hdr->nops++; 972 hdr->nops++;
973 hdr->replen += decode_getattr_maxsz; 973 hdr->replen += decode_getattr_maxsz;
974} 974}
@@ -996,7 +996,7 @@ static void encode_getfh(struct xdr_stream *xdr, struct compound_hdr *hdr)
996 __be32 *p; 996 __be32 *p;
997 997
998 p = reserve_space(xdr, 4); 998 p = reserve_space(xdr, 4);
999 *p++ = cpu_to_be32(OP_GETFH); 999 *p = cpu_to_be32(OP_GETFH);
1000 hdr->nops++; 1000 hdr->nops++;
1001 hdr->replen += decode_getfh_maxsz; 1001 hdr->replen += decode_getfh_maxsz;
1002} 1002}
@@ -1008,7 +1008,7 @@ static void encode_link(struct xdr_stream *xdr, const struct qstr *name, struct
1008 p = reserve_space(xdr, 8 + name->len); 1008 p = reserve_space(xdr, 8 + name->len);
1009 *p++ = cpu_to_be32(OP_LINK); 1009 *p++ = cpu_to_be32(OP_LINK);
1010 *p++ = cpu_to_be32(name->len); 1010 *p++ = cpu_to_be32(name->len);
1011 p = xdr_encode_opaque_fixed(p, name->name, name->len); 1011 xdr_encode_opaque_fixed(p, name->name, name->len);
1012 hdr->nops++; 1012 hdr->nops++;
1013 hdr->replen += decode_link_maxsz; 1013 hdr->replen += decode_link_maxsz;
1014} 1014}
@@ -1041,7 +1041,7 @@ static void encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args
1041 *p++ = cpu_to_be32(args->reclaim); 1041 *p++ = cpu_to_be32(args->reclaim);
1042 p = xdr_encode_hyper(p, args->fl->fl_start); 1042 p = xdr_encode_hyper(p, args->fl->fl_start);
1043 p = xdr_encode_hyper(p, nfs4_lock_length(args->fl)); 1043 p = xdr_encode_hyper(p, nfs4_lock_length(args->fl));
1044 *p++ = cpu_to_be32(args->new_lock_owner); 1044 *p = cpu_to_be32(args->new_lock_owner);
1045 if (args->new_lock_owner){ 1045 if (args->new_lock_owner){
1046 p = reserve_space(xdr, 4+NFS4_STATEID_SIZE+32); 1046 p = reserve_space(xdr, 4+NFS4_STATEID_SIZE+32);
1047 *p++ = cpu_to_be32(args->open_seqid->sequence->counter); 1047 *p++ = cpu_to_be32(args->open_seqid->sequence->counter);
@@ -1050,12 +1050,12 @@ static void encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args
1050 p = xdr_encode_hyper(p, args->lock_owner.clientid); 1050 p = xdr_encode_hyper(p, args->lock_owner.clientid);
1051 *p++ = cpu_to_be32(16); 1051 *p++ = cpu_to_be32(16);
1052 p = xdr_encode_opaque_fixed(p, "lock id:", 8); 1052 p = xdr_encode_opaque_fixed(p, "lock id:", 8);
1053 p = xdr_encode_hyper(p, args->lock_owner.id); 1053 xdr_encode_hyper(p, args->lock_owner.id);
1054 } 1054 }
1055 else { 1055 else {
1056 p = reserve_space(xdr, NFS4_STATEID_SIZE+4); 1056 p = reserve_space(xdr, NFS4_STATEID_SIZE+4);
1057 p = xdr_encode_opaque_fixed(p, args->lock_stateid->data, NFS4_STATEID_SIZE); 1057 p = xdr_encode_opaque_fixed(p, args->lock_stateid->data, NFS4_STATEID_SIZE);
1058 *p++ = cpu_to_be32(args->lock_seqid->sequence->counter); 1058 *p = cpu_to_be32(args->lock_seqid->sequence->counter);
1059 } 1059 }
1060 hdr->nops++; 1060 hdr->nops++;
1061 hdr->replen += decode_lock_maxsz; 1061 hdr->replen += decode_lock_maxsz;
@@ -1073,7 +1073,7 @@ static void encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *ar
1073 p = xdr_encode_hyper(p, args->lock_owner.clientid); 1073 p = xdr_encode_hyper(p, args->lock_owner.clientid);
1074 *p++ = cpu_to_be32(16); 1074 *p++ = cpu_to_be32(16);
1075 p = xdr_encode_opaque_fixed(p, "lock id:", 8); 1075 p = xdr_encode_opaque_fixed(p, "lock id:", 8);
1076 p = xdr_encode_hyper(p, args->lock_owner.id); 1076 xdr_encode_hyper(p, args->lock_owner.id);
1077 hdr->nops++; 1077 hdr->nops++;
1078 hdr->replen += decode_lockt_maxsz; 1078 hdr->replen += decode_lockt_maxsz;
1079} 1079}
@@ -1088,7 +1088,7 @@ static void encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *ar
1088 *p++ = cpu_to_be32(args->seqid->sequence->counter); 1088 *p++ = cpu_to_be32(args->seqid->sequence->counter);
1089 p = xdr_encode_opaque_fixed(p, args->stateid->data, NFS4_STATEID_SIZE); 1089 p = xdr_encode_opaque_fixed(p, args->stateid->data, NFS4_STATEID_SIZE);
1090 p = xdr_encode_hyper(p, args->fl->fl_start); 1090 p = xdr_encode_hyper(p, args->fl->fl_start);
1091 p = xdr_encode_hyper(p, nfs4_lock_length(args->fl)); 1091 xdr_encode_hyper(p, nfs4_lock_length(args->fl));
1092 hdr->nops++; 1092 hdr->nops++;
1093 hdr->replen += decode_locku_maxsz; 1093 hdr->replen += decode_locku_maxsz;
1094} 1094}
@@ -1101,7 +1101,7 @@ static void encode_lookup(struct xdr_stream *xdr, const struct qstr *name, struc
1101 p = reserve_space(xdr, 8 + len); 1101 p = reserve_space(xdr, 8 + len);
1102 *p++ = cpu_to_be32(OP_LOOKUP); 1102 *p++ = cpu_to_be32(OP_LOOKUP);
1103 *p++ = cpu_to_be32(len); 1103 *p++ = cpu_to_be32(len);
1104 p = xdr_encode_opaque_fixed(p, name->name, len); 1104 xdr_encode_opaque_fixed(p, name->name, len);
1105 hdr->nops++; 1105 hdr->nops++;
1106 hdr->replen += decode_lookup_maxsz; 1106 hdr->replen += decode_lookup_maxsz;
1107} 1107}
@@ -1124,7 +1124,7 @@ static void encode_share_access(struct xdr_stream *xdr, fmode_t fmode)
1124 default: 1124 default:
1125 *p++ = cpu_to_be32(0); 1125 *p++ = cpu_to_be32(0);
1126 } 1126 }
1127 *p++ = cpu_to_be32(0); /* for linux, share_deny = 0 always */ 1127 *p = cpu_to_be32(0); /* for linux, share_deny = 0 always */
1128} 1128}
1129 1129
1130static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_openargs *arg) 1130static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_openargs *arg)
@@ -1136,13 +1136,13 @@ static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_opena
1136 */ 1136 */
1137 p = reserve_space(xdr, 8); 1137 p = reserve_space(xdr, 8);
1138 *p++ = cpu_to_be32(OP_OPEN); 1138 *p++ = cpu_to_be32(OP_OPEN);
1139 *p++ = cpu_to_be32(arg->seqid->sequence->counter); 1139 *p = cpu_to_be32(arg->seqid->sequence->counter);
1140 encode_share_access(xdr, arg->fmode); 1140 encode_share_access(xdr, arg->fmode);
1141 p = reserve_space(xdr, 28); 1141 p = reserve_space(xdr, 28);
1142 p = xdr_encode_hyper(p, arg->clientid); 1142 p = xdr_encode_hyper(p, arg->clientid);
1143 *p++ = cpu_to_be32(16); 1143 *p++ = cpu_to_be32(16);
1144 p = xdr_encode_opaque_fixed(p, "open id:", 8); 1144 p = xdr_encode_opaque_fixed(p, "open id:", 8);
1145 p = xdr_encode_hyper(p, arg->id); 1145 xdr_encode_hyper(p, arg->id);
1146} 1146}
1147 1147
1148static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg) 1148static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg)
@@ -1152,11 +1152,11 @@ static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_op
1152 p = reserve_space(xdr, 4); 1152 p = reserve_space(xdr, 4);
1153 switch(arg->open_flags & O_EXCL) { 1153 switch(arg->open_flags & O_EXCL) {
1154 case 0: 1154 case 0:
1155 *p++ = cpu_to_be32(NFS4_CREATE_UNCHECKED); 1155 *p = cpu_to_be32(NFS4_CREATE_UNCHECKED);
1156 encode_attrs(xdr, arg->u.attrs, arg->server); 1156 encode_attrs(xdr, arg->u.attrs, arg->server);
1157 break; 1157 break;
1158 default: 1158 default:
1159 *p++ = cpu_to_be32(NFS4_CREATE_EXCLUSIVE); 1159 *p = cpu_to_be32(NFS4_CREATE_EXCLUSIVE);
1160 encode_nfs4_verifier(xdr, &arg->u.verifier); 1160 encode_nfs4_verifier(xdr, &arg->u.verifier);
1161 } 1161 }
1162} 1162}
@@ -1168,11 +1168,11 @@ static void encode_opentype(struct xdr_stream *xdr, const struct nfs_openargs *a
1168 p = reserve_space(xdr, 4); 1168 p = reserve_space(xdr, 4);
1169 switch (arg->open_flags & O_CREAT) { 1169 switch (arg->open_flags & O_CREAT) {
1170 case 0: 1170 case 0:
1171 *p++ = cpu_to_be32(NFS4_OPEN_NOCREATE); 1171 *p = cpu_to_be32(NFS4_OPEN_NOCREATE);
1172 break; 1172 break;
1173 default: 1173 default:
1174 BUG_ON(arg->claim != NFS4_OPEN_CLAIM_NULL); 1174 BUG_ON(arg->claim != NFS4_OPEN_CLAIM_NULL);
1175 *p++ = cpu_to_be32(NFS4_OPEN_CREATE); 1175 *p = cpu_to_be32(NFS4_OPEN_CREATE);
1176 encode_createmode(xdr, arg); 1176 encode_createmode(xdr, arg);
1177 } 1177 }
1178} 1178}
@@ -1184,13 +1184,13 @@ static inline void encode_delegation_type(struct xdr_stream *xdr, fmode_t delega
1184 p = reserve_space(xdr, 4); 1184 p = reserve_space(xdr, 4);
1185 switch (delegation_type) { 1185 switch (delegation_type) {
1186 case 0: 1186 case 0:
1187 *p++ = cpu_to_be32(NFS4_OPEN_DELEGATE_NONE); 1187 *p = cpu_to_be32(NFS4_OPEN_DELEGATE_NONE);
1188 break; 1188 break;
1189 case FMODE_READ: 1189 case FMODE_READ:
1190 *p++ = cpu_to_be32(NFS4_OPEN_DELEGATE_READ); 1190 *p = cpu_to_be32(NFS4_OPEN_DELEGATE_READ);
1191 break; 1191 break;
1192 case FMODE_WRITE|FMODE_READ: 1192 case FMODE_WRITE|FMODE_READ:
1193 *p++ = cpu_to_be32(NFS4_OPEN_DELEGATE_WRITE); 1193 *p = cpu_to_be32(NFS4_OPEN_DELEGATE_WRITE);
1194 break; 1194 break;
1195 default: 1195 default:
1196 BUG(); 1196 BUG();
@@ -1202,7 +1202,7 @@ static inline void encode_claim_null(struct xdr_stream *xdr, const struct qstr *
1202 __be32 *p; 1202 __be32 *p;
1203 1203
1204 p = reserve_space(xdr, 4); 1204 p = reserve_space(xdr, 4);
1205 *p++ = cpu_to_be32(NFS4_OPEN_CLAIM_NULL); 1205 *p = cpu_to_be32(NFS4_OPEN_CLAIM_NULL);
1206 encode_string(xdr, name->len, name->name); 1206 encode_string(xdr, name->len, name->name);
1207} 1207}
1208 1208
@@ -1211,7 +1211,7 @@ static inline void encode_claim_previous(struct xdr_stream *xdr, fmode_t type)
1211 __be32 *p; 1211 __be32 *p;
1212 1212
1213 p = reserve_space(xdr, 4); 1213 p = reserve_space(xdr, 4);
1214 *p++ = cpu_to_be32(NFS4_OPEN_CLAIM_PREVIOUS); 1214 *p = cpu_to_be32(NFS4_OPEN_CLAIM_PREVIOUS);
1215 encode_delegation_type(xdr, type); 1215 encode_delegation_type(xdr, type);
1216} 1216}
1217 1217
@@ -1221,7 +1221,7 @@ static inline void encode_claim_delegate_cur(struct xdr_stream *xdr, const struc
1221 1221
1222 p = reserve_space(xdr, 4+NFS4_STATEID_SIZE); 1222 p = reserve_space(xdr, 4+NFS4_STATEID_SIZE);
1223 *p++ = cpu_to_be32(NFS4_OPEN_CLAIM_DELEGATE_CUR); 1223 *p++ = cpu_to_be32(NFS4_OPEN_CLAIM_DELEGATE_CUR);
1224 p = xdr_encode_opaque_fixed(p, stateid->data, NFS4_STATEID_SIZE); 1224 xdr_encode_opaque_fixed(p, stateid->data, NFS4_STATEID_SIZE);
1225 encode_string(xdr, name->len, name->name); 1225 encode_string(xdr, name->len, name->name);
1226} 1226}
1227 1227
@@ -1253,7 +1253,7 @@ static void encode_open_confirm(struct xdr_stream *xdr, const struct nfs_open_co
1253 p = reserve_space(xdr, 4+NFS4_STATEID_SIZE+4); 1253 p = reserve_space(xdr, 4+NFS4_STATEID_SIZE+4);
1254 *p++ = cpu_to_be32(OP_OPEN_CONFIRM); 1254 *p++ = cpu_to_be32(OP_OPEN_CONFIRM);
1255 p = xdr_encode_opaque_fixed(p, arg->stateid->data, NFS4_STATEID_SIZE); 1255 p = xdr_encode_opaque_fixed(p, arg->stateid->data, NFS4_STATEID_SIZE);
1256 *p++ = cpu_to_be32(arg->seqid->sequence->counter); 1256 *p = cpu_to_be32(arg->seqid->sequence->counter);
1257 hdr->nops++; 1257 hdr->nops++;
1258 hdr->replen += decode_open_confirm_maxsz; 1258 hdr->replen += decode_open_confirm_maxsz;
1259} 1259}
@@ -1265,7 +1265,7 @@ static void encode_open_downgrade(struct xdr_stream *xdr, const struct nfs_close
1265 p = reserve_space(xdr, 4+NFS4_STATEID_SIZE+4); 1265 p = reserve_space(xdr, 4+NFS4_STATEID_SIZE+4);
1266 *p++ = cpu_to_be32(OP_OPEN_DOWNGRADE); 1266 *p++ = cpu_to_be32(OP_OPEN_DOWNGRADE);
1267 p = xdr_encode_opaque_fixed(p, arg->stateid->data, NFS4_STATEID_SIZE); 1267 p = xdr_encode_opaque_fixed(p, arg->stateid->data, NFS4_STATEID_SIZE);
1268 *p++ = cpu_to_be32(arg->seqid->sequence->counter); 1268 *p = cpu_to_be32(arg->seqid->sequence->counter);
1269 encode_share_access(xdr, arg->fmode); 1269 encode_share_access(xdr, arg->fmode);
1270 hdr->nops++; 1270 hdr->nops++;
1271 hdr->replen += decode_open_downgrade_maxsz; 1271 hdr->replen += decode_open_downgrade_maxsz;
@@ -1280,7 +1280,7 @@ encode_putfh(struct xdr_stream *xdr, const struct nfs_fh *fh, struct compound_hd
1280 p = reserve_space(xdr, 8 + len); 1280 p = reserve_space(xdr, 8 + len);
1281 *p++ = cpu_to_be32(OP_PUTFH); 1281 *p++ = cpu_to_be32(OP_PUTFH);
1282 *p++ = cpu_to_be32(len); 1282 *p++ = cpu_to_be32(len);
1283 p = xdr_encode_opaque_fixed(p, fh->data, len); 1283 xdr_encode_opaque_fixed(p, fh->data, len);
1284 hdr->nops++; 1284 hdr->nops++;
1285 hdr->replen += decode_putfh_maxsz; 1285 hdr->replen += decode_putfh_maxsz;
1286} 1286}
@@ -1290,7 +1290,7 @@ static void encode_putrootfh(struct xdr_stream *xdr, struct compound_hdr *hdr)
1290 __be32 *p; 1290 __be32 *p;
1291 1291
1292 p = reserve_space(xdr, 4); 1292 p = reserve_space(xdr, 4);
1293 *p++ = cpu_to_be32(OP_PUTROOTFH); 1293 *p = cpu_to_be32(OP_PUTROOTFH);
1294 hdr->nops++; 1294 hdr->nops++;
1295 hdr->replen += decode_putrootfh_maxsz; 1295 hdr->replen += decode_putrootfh_maxsz;
1296} 1296}
@@ -1303,9 +1303,9 @@ static void encode_stateid(struct xdr_stream *xdr, const struct nfs_open_context
1303 p = reserve_space(xdr, NFS4_STATEID_SIZE); 1303 p = reserve_space(xdr, NFS4_STATEID_SIZE);
1304 if (ctx->state != NULL) { 1304 if (ctx->state != NULL) {
1305 nfs4_copy_stateid(&stateid, ctx->state, ctx->lockowner); 1305 nfs4_copy_stateid(&stateid, ctx->state, ctx->lockowner);
1306 p = xdr_encode_opaque_fixed(p, stateid.data, NFS4_STATEID_SIZE); 1306 xdr_encode_opaque_fixed(p, stateid.data, NFS4_STATEID_SIZE);
1307 } else 1307 } else
1308 p = xdr_encode_opaque_fixed(p, zero_stateid.data, NFS4_STATEID_SIZE); 1308 xdr_encode_opaque_fixed(p, zero_stateid.data, NFS4_STATEID_SIZE);
1309} 1309}
1310 1310
1311static void encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args, struct compound_hdr *hdr) 1311static void encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args, struct compound_hdr *hdr)
@@ -1313,13 +1313,13 @@ static void encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args,
1313 __be32 *p; 1313 __be32 *p;
1314 1314
1315 p = reserve_space(xdr, 4); 1315 p = reserve_space(xdr, 4);
1316 *p++ = cpu_to_be32(OP_READ); 1316 *p = cpu_to_be32(OP_READ);
1317 1317
1318 encode_stateid(xdr, args->context); 1318 encode_stateid(xdr, args->context);
1319 1319
1320 p = reserve_space(xdr, 12); 1320 p = reserve_space(xdr, 12);
1321 p = xdr_encode_hyper(p, args->offset); 1321 p = xdr_encode_hyper(p, args->offset);
1322 *p++ = cpu_to_be32(args->count); 1322 *p = cpu_to_be32(args->count);
1323 hdr->nops++; 1323 hdr->nops++;
1324 hdr->replen += decode_read_maxsz; 1324 hdr->replen += decode_read_maxsz;
1325} 1325}
@@ -1345,7 +1345,7 @@ static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg
1345 else 1345 else
1346 attrs[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; 1346 attrs[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID;
1347 *p++ = cpu_to_be32(attrs[0] & readdir->bitmask[0]); 1347 *p++ = cpu_to_be32(attrs[0] & readdir->bitmask[0]);
1348 *p++ = cpu_to_be32(attrs[1] & readdir->bitmask[1]); 1348 *p = cpu_to_be32(attrs[1] & readdir->bitmask[1]);
1349 hdr->nops++; 1349 hdr->nops++;
1350 hdr->replen += decode_readdir_maxsz; 1350 hdr->replen += decode_readdir_maxsz;
1351 dprintk("%s: cookie = %Lu, verifier = %08x:%08x, bitmap = %08x:%08x\n", 1351 dprintk("%s: cookie = %Lu, verifier = %08x:%08x, bitmap = %08x:%08x\n",
@@ -1362,7 +1362,7 @@ static void encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *
1362 __be32 *p; 1362 __be32 *p;
1363 1363
1364 p = reserve_space(xdr, 4); 1364 p = reserve_space(xdr, 4);
1365 *p++ = cpu_to_be32(OP_READLINK); 1365 *p = cpu_to_be32(OP_READLINK);
1366 hdr->nops++; 1366 hdr->nops++;
1367 hdr->replen += decode_readlink_maxsz; 1367 hdr->replen += decode_readlink_maxsz;
1368} 1368}
@@ -1374,7 +1374,7 @@ static void encode_remove(struct xdr_stream *xdr, const struct qstr *name, struc
1374 p = reserve_space(xdr, 8 + name->len); 1374 p = reserve_space(xdr, 8 + name->len);
1375 *p++ = cpu_to_be32(OP_REMOVE); 1375 *p++ = cpu_to_be32(OP_REMOVE);
1376 *p++ = cpu_to_be32(name->len); 1376 *p++ = cpu_to_be32(name->len);
1377 p = xdr_encode_opaque_fixed(p, name->name, name->len); 1377 xdr_encode_opaque_fixed(p, name->name, name->len);
1378 hdr->nops++; 1378 hdr->nops++;
1379 hdr->replen += decode_remove_maxsz; 1379 hdr->replen += decode_remove_maxsz;
1380} 1380}
@@ -1386,11 +1386,11 @@ static void encode_rename(struct xdr_stream *xdr, const struct qstr *oldname, co
1386 p = reserve_space(xdr, 8 + oldname->len); 1386 p = reserve_space(xdr, 8 + oldname->len);
1387 *p++ = cpu_to_be32(OP_RENAME); 1387 *p++ = cpu_to_be32(OP_RENAME);
1388 *p++ = cpu_to_be32(oldname->len); 1388 *p++ = cpu_to_be32(oldname->len);
1389 p = xdr_encode_opaque_fixed(p, oldname->name, oldname->len); 1389 xdr_encode_opaque_fixed(p, oldname->name, oldname->len);
1390 1390
1391 p = reserve_space(xdr, 4 + newname->len); 1391 p = reserve_space(xdr, 4 + newname->len);
1392 *p++ = cpu_to_be32(newname->len); 1392 *p++ = cpu_to_be32(newname->len);
1393 p = xdr_encode_opaque_fixed(p, newname->name, newname->len); 1393 xdr_encode_opaque_fixed(p, newname->name, newname->len);
1394 hdr->nops++; 1394 hdr->nops++;
1395 hdr->replen += decode_rename_maxsz; 1395 hdr->replen += decode_rename_maxsz;
1396} 1396}
@@ -1401,7 +1401,7 @@ static void encode_renew(struct xdr_stream *xdr, const struct nfs_client *client
1401 1401
1402 p = reserve_space(xdr, 12); 1402 p = reserve_space(xdr, 12);
1403 *p++ = cpu_to_be32(OP_RENEW); 1403 *p++ = cpu_to_be32(OP_RENEW);
1404 p = xdr_encode_hyper(p, client_stateid->cl_clientid); 1404 xdr_encode_hyper(p, client_stateid->cl_clientid);
1405 hdr->nops++; 1405 hdr->nops++;
1406 hdr->replen += decode_renew_maxsz; 1406 hdr->replen += decode_renew_maxsz;
1407} 1407}
@@ -1412,7 +1412,7 @@ encode_restorefh(struct xdr_stream *xdr, struct compound_hdr *hdr)
1412 __be32 *p; 1412 __be32 *p;
1413 1413
1414 p = reserve_space(xdr, 4); 1414 p = reserve_space(xdr, 4);
1415 *p++ = cpu_to_be32(OP_RESTOREFH); 1415 *p = cpu_to_be32(OP_RESTOREFH);
1416 hdr->nops++; 1416 hdr->nops++;
1417 hdr->replen += decode_restorefh_maxsz; 1417 hdr->replen += decode_restorefh_maxsz;
1418} 1418}
@@ -1424,14 +1424,14 @@ encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg, struct compoun
1424 1424
1425 p = reserve_space(xdr, 4+NFS4_STATEID_SIZE); 1425 p = reserve_space(xdr, 4+NFS4_STATEID_SIZE);
1426 *p++ = cpu_to_be32(OP_SETATTR); 1426 *p++ = cpu_to_be32(OP_SETATTR);
1427 p = xdr_encode_opaque_fixed(p, zero_stateid.data, NFS4_STATEID_SIZE); 1427 xdr_encode_opaque_fixed(p, zero_stateid.data, NFS4_STATEID_SIZE);
1428 p = reserve_space(xdr, 2*4); 1428 p = reserve_space(xdr, 2*4);
1429 *p++ = cpu_to_be32(1); 1429 *p++ = cpu_to_be32(1);
1430 *p++ = cpu_to_be32(FATTR4_WORD0_ACL); 1430 *p = cpu_to_be32(FATTR4_WORD0_ACL);
1431 if (arg->acl_len % 4) 1431 if (arg->acl_len % 4)
1432 return -EINVAL; 1432 return -EINVAL;
1433 p = reserve_space(xdr, 4); 1433 p = reserve_space(xdr, 4);
1434 *p++ = cpu_to_be32(arg->acl_len); 1434 *p = cpu_to_be32(arg->acl_len);
1435 xdr_write_pages(xdr, arg->acl_pages, arg->acl_pgbase, arg->acl_len); 1435 xdr_write_pages(xdr, arg->acl_pages, arg->acl_pgbase, arg->acl_len);
1436 hdr->nops++; 1436 hdr->nops++;
1437 hdr->replen += decode_setacl_maxsz; 1437 hdr->replen += decode_setacl_maxsz;
@@ -1444,7 +1444,7 @@ encode_savefh(struct xdr_stream *xdr, struct compound_hdr *hdr)
1444 __be32 *p; 1444 __be32 *p;
1445 1445
1446 p = reserve_space(xdr, 4); 1446 p = reserve_space(xdr, 4);
1447 *p++ = cpu_to_be32(OP_SAVEFH); 1447 *p = cpu_to_be32(OP_SAVEFH);
1448 hdr->nops++; 1448 hdr->nops++;
1449 hdr->replen += decode_savefh_maxsz; 1449 hdr->replen += decode_savefh_maxsz;
1450} 1450}
@@ -1455,7 +1455,7 @@ static void encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs
1455 1455
1456 p = reserve_space(xdr, 4+NFS4_STATEID_SIZE); 1456 p = reserve_space(xdr, 4+NFS4_STATEID_SIZE);
1457 *p++ = cpu_to_be32(OP_SETATTR); 1457 *p++ = cpu_to_be32(OP_SETATTR);
1458 p = xdr_encode_opaque_fixed(p, arg->stateid.data, NFS4_STATEID_SIZE); 1458 xdr_encode_opaque_fixed(p, arg->stateid.data, NFS4_STATEID_SIZE);
1459 hdr->nops++; 1459 hdr->nops++;
1460 hdr->replen += decode_setattr_maxsz; 1460 hdr->replen += decode_setattr_maxsz;
1461 encode_attrs(xdr, arg->iap, server); 1461 encode_attrs(xdr, arg->iap, server);
@@ -1467,15 +1467,15 @@ static void encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclie
1467 1467
1468 p = reserve_space(xdr, 4 + NFS4_VERIFIER_SIZE); 1468 p = reserve_space(xdr, 4 + NFS4_VERIFIER_SIZE);
1469 *p++ = cpu_to_be32(OP_SETCLIENTID); 1469 *p++ = cpu_to_be32(OP_SETCLIENTID);
1470 p = xdr_encode_opaque_fixed(p, setclientid->sc_verifier->data, NFS4_VERIFIER_SIZE); 1470 xdr_encode_opaque_fixed(p, setclientid->sc_verifier->data, NFS4_VERIFIER_SIZE);
1471 1471
1472 encode_string(xdr, setclientid->sc_name_len, setclientid->sc_name); 1472 encode_string(xdr, setclientid->sc_name_len, setclientid->sc_name);
1473 p = reserve_space(xdr, 4); 1473 p = reserve_space(xdr, 4);
1474 *p++ = cpu_to_be32(setclientid->sc_prog); 1474 *p = cpu_to_be32(setclientid->sc_prog);
1475 encode_string(xdr, setclientid->sc_netid_len, setclientid->sc_netid); 1475 encode_string(xdr, setclientid->sc_netid_len, setclientid->sc_netid);
1476 encode_string(xdr, setclientid->sc_uaddr_len, setclientid->sc_uaddr); 1476 encode_string(xdr, setclientid->sc_uaddr_len, setclientid->sc_uaddr);
1477 p = reserve_space(xdr, 4); 1477 p = reserve_space(xdr, 4);
1478 *p++ = cpu_to_be32(setclientid->sc_cb_ident); 1478 *p = cpu_to_be32(setclientid->sc_cb_ident);
1479 hdr->nops++; 1479 hdr->nops++;
1480 hdr->replen += decode_setclientid_maxsz; 1480 hdr->replen += decode_setclientid_maxsz;
1481} 1481}
@@ -1487,7 +1487,7 @@ static void encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_
1487 p = reserve_space(xdr, 12 + NFS4_VERIFIER_SIZE); 1487 p = reserve_space(xdr, 12 + NFS4_VERIFIER_SIZE);
1488 *p++ = cpu_to_be32(OP_SETCLIENTID_CONFIRM); 1488 *p++ = cpu_to_be32(OP_SETCLIENTID_CONFIRM);
1489 p = xdr_encode_hyper(p, client_state->cl_clientid); 1489 p = xdr_encode_hyper(p, client_state->cl_clientid);
1490 p = xdr_encode_opaque_fixed(p, client_state->cl_confirm.data, NFS4_VERIFIER_SIZE); 1490 xdr_encode_opaque_fixed(p, client_state->cl_confirm.data, NFS4_VERIFIER_SIZE);
1491 hdr->nops++; 1491 hdr->nops++;
1492 hdr->replen += decode_setclientid_confirm_maxsz; 1492 hdr->replen += decode_setclientid_confirm_maxsz;
1493} 1493}
@@ -1497,14 +1497,14 @@ static void encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *arg
1497 __be32 *p; 1497 __be32 *p;
1498 1498
1499 p = reserve_space(xdr, 4); 1499 p = reserve_space(xdr, 4);
1500 *p++ = cpu_to_be32(OP_WRITE); 1500 *p = cpu_to_be32(OP_WRITE);
1501 1501
1502 encode_stateid(xdr, args->context); 1502 encode_stateid(xdr, args->context);
1503 1503
1504 p = reserve_space(xdr, 16); 1504 p = reserve_space(xdr, 16);
1505 p = xdr_encode_hyper(p, args->offset); 1505 p = xdr_encode_hyper(p, args->offset);
1506 *p++ = cpu_to_be32(args->stable); 1506 *p++ = cpu_to_be32(args->stable);
1507 *p++ = cpu_to_be32(args->count); 1507 *p = cpu_to_be32(args->count);
1508 1508
1509 xdr_write_pages(xdr, args->pages, args->pgbase, args->count); 1509 xdr_write_pages(xdr, args->pages, args->pgbase, args->count);
1510 hdr->nops++; 1510 hdr->nops++;
@@ -1518,7 +1518,7 @@ static void encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *state
1518 p = reserve_space(xdr, 4+NFS4_STATEID_SIZE); 1518 p = reserve_space(xdr, 4+NFS4_STATEID_SIZE);
1519 1519
1520 *p++ = cpu_to_be32(OP_DELEGRETURN); 1520 *p++ = cpu_to_be32(OP_DELEGRETURN);
1521 p = xdr_encode_opaque_fixed(p, stateid->data, NFS4_STATEID_SIZE); 1521 xdr_encode_opaque_fixed(p, stateid->data, NFS4_STATEID_SIZE);
1522 hdr->nops++; 1522 hdr->nops++;
1523 hdr->replen += decode_delegreturn_maxsz; 1523 hdr->replen += decode_delegreturn_maxsz;
1524} 1524}
@@ -1533,14 +1533,14 @@ static void encode_exchange_id(struct xdr_stream *xdr,
1533 1533
1534 p = reserve_space(xdr, 4 + sizeof(args->verifier->data)); 1534 p = reserve_space(xdr, 4 + sizeof(args->verifier->data));
1535 *p++ = cpu_to_be32(OP_EXCHANGE_ID); 1535 *p++ = cpu_to_be32(OP_EXCHANGE_ID);
1536 p = xdr_encode_opaque_fixed(p, args->verifier->data, sizeof(args->verifier->data)); 1536 xdr_encode_opaque_fixed(p, args->verifier->data, sizeof(args->verifier->data));
1537 1537
1538 encode_string(xdr, args->id_len, args->id); 1538 encode_string(xdr, args->id_len, args->id);
1539 1539
1540 p = reserve_space(xdr, 12); 1540 p = reserve_space(xdr, 12);
1541 *p++ = cpu_to_be32(args->flags); 1541 *p++ = cpu_to_be32(args->flags);
1542 *p++ = cpu_to_be32(0); /* zero length state_protect4_a */ 1542 *p++ = cpu_to_be32(0); /* zero length state_protect4_a */
1543 *p++ = cpu_to_be32(0); /* zero length implementation id array */ 1543 *p = cpu_to_be32(0); /* zero length implementation id array */
1544 hdr->nops++; 1544 hdr->nops++;
1545 hdr->replen += decode_exchange_id_maxsz; 1545 hdr->replen += decode_exchange_id_maxsz;
1546} 1546}
@@ -1591,7 +1591,7 @@ static void encode_create_session(struct xdr_stream *xdr,
1591 p = xdr_encode_opaque_fixed(p, machine_name, len); 1591 p = xdr_encode_opaque_fixed(p, machine_name, len);
1592 *p++ = cpu_to_be32(0); /* UID */ 1592 *p++ = cpu_to_be32(0); /* UID */
1593 *p++ = cpu_to_be32(0); /* GID */ 1593 *p++ = cpu_to_be32(0); /* GID */
1594 *p++ = cpu_to_be32(0); /* No more gids */ 1594 *p = cpu_to_be32(0); /* No more gids */
1595 hdr->nops++; 1595 hdr->nops++;
1596 hdr->replen += decode_create_session_maxsz; 1596 hdr->replen += decode_create_session_maxsz;
1597} 1597}
@@ -1603,7 +1603,7 @@ static void encode_destroy_session(struct xdr_stream *xdr,
1603 __be32 *p; 1603 __be32 *p;
1604 p = reserve_space(xdr, 4 + NFS4_MAX_SESSIONID_LEN); 1604 p = reserve_space(xdr, 4 + NFS4_MAX_SESSIONID_LEN);
1605 *p++ = cpu_to_be32(OP_DESTROY_SESSION); 1605 *p++ = cpu_to_be32(OP_DESTROY_SESSION);
1606 p = xdr_encode_opaque_fixed(p, session->sess_id.data, NFS4_MAX_SESSIONID_LEN); 1606 xdr_encode_opaque_fixed(p, session->sess_id.data, NFS4_MAX_SESSIONID_LEN);
1607 hdr->nops++; 1607 hdr->nops++;
1608 hdr->replen += decode_destroy_session_maxsz; 1608 hdr->replen += decode_destroy_session_maxsz;
1609} 1609}
@@ -1646,7 +1646,7 @@ static void encode_sequence(struct xdr_stream *xdr,
1646 *p++ = cpu_to_be32(slot->seq_nr); 1646 *p++ = cpu_to_be32(slot->seq_nr);
1647 *p++ = cpu_to_be32(args->sa_slotid); 1647 *p++ = cpu_to_be32(args->sa_slotid);
1648 *p++ = cpu_to_be32(tp->highest_used_slotid); 1648 *p++ = cpu_to_be32(tp->highest_used_slotid);
1649 *p++ = cpu_to_be32(args->sa_cache_this); 1649 *p = cpu_to_be32(args->sa_cache_this);
1650 hdr->nops++; 1650 hdr->nops++;
1651 hdr->replen += decode_sequence_maxsz; 1651 hdr->replen += decode_sequence_maxsz;
1652#endif /* CONFIG_NFS_V4_1 */ 1652#endif /* CONFIG_NFS_V4_1 */