aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4xdr.c
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2009-04-01 09:22:08 -0400
committerBenny Halevy <bhalevy@panasas.com>2009-06-17 13:46:33 -0400
commitdadf0c2767ce7772fc4ff82044f3ba5823e5b79f (patch)
tree59067085f4525ccd56e29d09f07be4f4b9148013 /fs/nfs/nfs4xdr.c
parent0c4e8c187758258ec58842384fe6a99cf1ce16c7 (diff)
NFS: update hdr->replen for every encode op
Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r--fs/nfs/nfs4xdr.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index c85dbee34b8a..746c6a52794c 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -749,6 +749,7 @@ static void encode_access(struct xdr_stream *xdr, u32 access, struct compound_hd
749 WRITE32(OP_ACCESS); 749 WRITE32(OP_ACCESS);
750 WRITE32(access); 750 WRITE32(access);
751 hdr->nops++; 751 hdr->nops++;
752 hdr->replen += decode_access_maxsz;
752} 753}
753 754
754static void encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg, struct compound_hdr *hdr) 755static void encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg, struct compound_hdr *hdr)
@@ -760,6 +761,7 @@ static void encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg
760 WRITE32(arg->seqid->sequence->counter); 761 WRITE32(arg->seqid->sequence->counter);
761 WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE); 762 WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE);
762 hdr->nops++; 763 hdr->nops++;
764 hdr->replen += decode_close_maxsz;
763} 765}
764 766
765static void encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *args, struct compound_hdr *hdr) 767static void encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *args, struct compound_hdr *hdr)
@@ -771,6 +773,7 @@ static void encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *ar
771 WRITE64(args->offset); 773 WRITE64(args->offset);
772 WRITE32(args->count); 774 WRITE32(args->count);
773 hdr->nops++; 775 hdr->nops++;
776 hdr->replen += decode_commit_maxsz;
774} 777}
775 778
776static void encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *create, struct compound_hdr *hdr) 779static void encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *create, struct compound_hdr *hdr)
@@ -802,6 +805,7 @@ static void encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *
802 WRITE32(create->name->len); 805 WRITE32(create->name->len);
803 WRITEMEM(create->name->name, create->name->len); 806 WRITEMEM(create->name->name, create->name->len);
804 hdr->nops++; 807 hdr->nops++;
808 hdr->replen += decode_create_maxsz;
805 809
806 encode_attrs(xdr, create->attrs, create->server); 810 encode_attrs(xdr, create->attrs, create->server);
807} 811}
@@ -815,6 +819,7 @@ static void encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap, struct c
815 WRITE32(1); 819 WRITE32(1);
816 WRITE32(bitmap); 820 WRITE32(bitmap);
817 hdr->nops++; 821 hdr->nops++;
822 hdr->replen += decode_getattr_maxsz;
818} 823}
819 824
820static void encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0, uint32_t bm1, struct compound_hdr *hdr) 825static void encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0, uint32_t bm1, struct compound_hdr *hdr)
@@ -827,6 +832,7 @@ static void encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0, uint32_t bm
827 WRITE32(bm0); 832 WRITE32(bm0);
828 WRITE32(bm1); 833 WRITE32(bm1);
829 hdr->nops++; 834 hdr->nops++;
835 hdr->replen += decode_getattr_maxsz;
830} 836}
831 837
832static void encode_getfattr(struct xdr_stream *xdr, const u32* bitmask, struct compound_hdr *hdr) 838static void encode_getfattr(struct xdr_stream *xdr, const u32* bitmask, struct compound_hdr *hdr)
@@ -854,6 +860,7 @@ static void encode_getfh(struct xdr_stream *xdr, struct compound_hdr *hdr)
854 RESERVE_SPACE(4); 860 RESERVE_SPACE(4);
855 WRITE32(OP_GETFH); 861 WRITE32(OP_GETFH);
856 hdr->nops++; 862 hdr->nops++;
863 hdr->replen += decode_getfh_maxsz;
857} 864}
858 865
859static void encode_link(struct xdr_stream *xdr, const struct qstr *name, struct compound_hdr *hdr) 866static void encode_link(struct xdr_stream *xdr, const struct qstr *name, struct compound_hdr *hdr)
@@ -865,6 +872,7 @@ static void encode_link(struct xdr_stream *xdr, const struct qstr *name, struct
865 WRITE32(name->len); 872 WRITE32(name->len);
866 WRITEMEM(name->name, name->len); 873 WRITEMEM(name->name, name->len);
867 hdr->nops++; 874 hdr->nops++;
875 hdr->replen += decode_link_maxsz;
868} 876}
869 877
870static inline int nfs4_lock_type(struct file_lock *fl, int block) 878static inline int nfs4_lock_type(struct file_lock *fl, int block)
@@ -912,6 +920,7 @@ static void encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args
912 WRITE32(args->lock_seqid->sequence->counter); 920 WRITE32(args->lock_seqid->sequence->counter);
913 } 921 }
914 hdr->nops++; 922 hdr->nops++;
923 hdr->replen += decode_lock_maxsz;
915} 924}
916 925
917static void encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *args, struct compound_hdr *hdr) 926static void encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *args, struct compound_hdr *hdr)
@@ -928,6 +937,7 @@ static void encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *ar
928 WRITEMEM("lock id:", 8); 937 WRITEMEM("lock id:", 8);
929 WRITE64(args->lock_owner.id); 938 WRITE64(args->lock_owner.id);
930 hdr->nops++; 939 hdr->nops++;
940 hdr->replen += decode_lockt_maxsz;
931} 941}
932 942
933static void encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *args, struct compound_hdr *hdr) 943static void encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *args, struct compound_hdr *hdr)
@@ -942,6 +952,7 @@ static void encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *ar
942 WRITE64(args->fl->fl_start); 952 WRITE64(args->fl->fl_start);
943 WRITE64(nfs4_lock_length(args->fl)); 953 WRITE64(nfs4_lock_length(args->fl));
944 hdr->nops++; 954 hdr->nops++;
955 hdr->replen += decode_locku_maxsz;
945} 956}
946 957
947static void encode_lookup(struct xdr_stream *xdr, const struct qstr *name, struct compound_hdr *hdr) 958static void encode_lookup(struct xdr_stream *xdr, const struct qstr *name, struct compound_hdr *hdr)
@@ -954,6 +965,7 @@ static void encode_lookup(struct xdr_stream *xdr, const struct qstr *name, struc
954 WRITE32(len); 965 WRITE32(len);
955 WRITEMEM(name->name, len); 966 WRITEMEM(name->name, len);
956 hdr->nops++; 967 hdr->nops++;
968 hdr->replen += decode_lookup_maxsz;
957} 969}
958 970
959static void encode_share_access(struct xdr_stream *xdr, fmode_t fmode) 971static void encode_share_access(struct xdr_stream *xdr, fmode_t fmode)
@@ -1093,6 +1105,7 @@ static void encode_open(struct xdr_stream *xdr, const struct nfs_openargs *arg,
1093 BUG(); 1105 BUG();
1094 } 1106 }
1095 hdr->nops++; 1107 hdr->nops++;
1108 hdr->replen += decode_open_maxsz;
1096} 1109}
1097 1110
1098static void encode_open_confirm(struct xdr_stream *xdr, const struct nfs_open_confirmargs *arg, struct compound_hdr *hdr) 1111static void encode_open_confirm(struct xdr_stream *xdr, const struct nfs_open_confirmargs *arg, struct compound_hdr *hdr)
@@ -1104,6 +1117,7 @@ static void encode_open_confirm(struct xdr_stream *xdr, const struct nfs_open_co
1104 WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE); 1117 WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE);
1105 WRITE32(arg->seqid->sequence->counter); 1118 WRITE32(arg->seqid->sequence->counter);
1106 hdr->nops++; 1119 hdr->nops++;
1120 hdr->replen += decode_open_confirm_maxsz;
1107} 1121}
1108 1122
1109static void encode_open_downgrade(struct xdr_stream *xdr, const struct nfs_closeargs *arg, struct compound_hdr *hdr) 1123static void encode_open_downgrade(struct xdr_stream *xdr, const struct nfs_closeargs *arg, struct compound_hdr *hdr)
@@ -1116,6 +1130,7 @@ static void encode_open_downgrade(struct xdr_stream *xdr, const struct nfs_close
1116 WRITE32(arg->seqid->sequence->counter); 1130 WRITE32(arg->seqid->sequence->counter);
1117 encode_share_access(xdr, arg->fmode); 1131 encode_share_access(xdr, arg->fmode);
1118 hdr->nops++; 1132 hdr->nops++;
1133 hdr->replen += decode_open_downgrade_maxsz;
1119} 1134}
1120 1135
1121static void 1136static void
@@ -1129,6 +1144,7 @@ encode_putfh(struct xdr_stream *xdr, const struct nfs_fh *fh, struct compound_hd
1129 WRITE32(len); 1144 WRITE32(len);
1130 WRITEMEM(fh->data, len); 1145 WRITEMEM(fh->data, len);
1131 hdr->nops++; 1146 hdr->nops++;
1147 hdr->replen += decode_putfh_maxsz;
1132} 1148}
1133 1149
1134static void encode_putrootfh(struct xdr_stream *xdr, struct compound_hdr *hdr) 1150static void encode_putrootfh(struct xdr_stream *xdr, struct compound_hdr *hdr)
@@ -1138,6 +1154,7 @@ static void encode_putrootfh(struct xdr_stream *xdr, struct compound_hdr *hdr)
1138 RESERVE_SPACE(4); 1154 RESERVE_SPACE(4);
1139 WRITE32(OP_PUTROOTFH); 1155 WRITE32(OP_PUTROOTFH);
1140 hdr->nops++; 1156 hdr->nops++;
1157 hdr->replen += decode_putrootfh_maxsz;
1141} 1158}
1142 1159
1143static void encode_stateid(struct xdr_stream *xdr, const struct nfs_open_context *ctx) 1160static void encode_stateid(struct xdr_stream *xdr, const struct nfs_open_context *ctx)
@@ -1166,6 +1183,7 @@ static void encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args,
1166 WRITE64(args->offset); 1183 WRITE64(args->offset);
1167 WRITE32(args->count); 1184 WRITE32(args->count);
1168 hdr->nops++; 1185 hdr->nops++;
1186 hdr->replen += decode_read_maxsz;
1169} 1187}
1170 1188
1171static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req, struct compound_hdr *hdr) 1189static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req, struct compound_hdr *hdr)
@@ -1191,6 +1209,7 @@ static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg
1191 WRITE32(attrs[0] & readdir->bitmask[0]); 1209 WRITE32(attrs[0] & readdir->bitmask[0]);
1192 WRITE32(attrs[1] & readdir->bitmask[1]); 1210 WRITE32(attrs[1] & readdir->bitmask[1]);
1193 hdr->nops++; 1211 hdr->nops++;
1212 hdr->replen += decode_readdir_maxsz;
1194 dprintk("%s: cookie = %Lu, verifier = %08x:%08x, bitmap = %08x:%08x\n", 1213 dprintk("%s: cookie = %Lu, verifier = %08x:%08x, bitmap = %08x:%08x\n",
1195 __func__, 1214 __func__,
1196 (unsigned long long)readdir->cookie, 1215 (unsigned long long)readdir->cookie,
@@ -1207,6 +1226,7 @@ static void encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *
1207 RESERVE_SPACE(4); 1226 RESERVE_SPACE(4);
1208 WRITE32(OP_READLINK); 1227 WRITE32(OP_READLINK);
1209 hdr->nops++; 1228 hdr->nops++;
1229 hdr->replen += decode_readlink_maxsz;
1210} 1230}
1211 1231
1212static void encode_remove(struct xdr_stream *xdr, const struct qstr *name, struct compound_hdr *hdr) 1232static void encode_remove(struct xdr_stream *xdr, const struct qstr *name, struct compound_hdr *hdr)
@@ -1218,6 +1238,7 @@ static void encode_remove(struct xdr_stream *xdr, const struct qstr *name, struc
1218 WRITE32(name->len); 1238 WRITE32(name->len);
1219 WRITEMEM(name->name, name->len); 1239 WRITEMEM(name->name, name->len);
1220 hdr->nops++; 1240 hdr->nops++;
1241 hdr->replen += decode_remove_maxsz;
1221} 1242}
1222 1243
1223static void encode_rename(struct xdr_stream *xdr, const struct qstr *oldname, const struct qstr *newname, struct compound_hdr *hdr) 1244static void encode_rename(struct xdr_stream *xdr, const struct qstr *oldname, const struct qstr *newname, struct compound_hdr *hdr)
@@ -1233,6 +1254,7 @@ static void encode_rename(struct xdr_stream *xdr, const struct qstr *oldname, co
1233 WRITE32(newname->len); 1254 WRITE32(newname->len);
1234 WRITEMEM(newname->name, newname->len); 1255 WRITEMEM(newname->name, newname->len);
1235 hdr->nops++; 1256 hdr->nops++;
1257 hdr->replen += decode_rename_maxsz;
1236} 1258}
1237 1259
1238static void encode_renew(struct xdr_stream *xdr, const struct nfs_client *client_stateid, struct compound_hdr *hdr) 1260static void encode_renew(struct xdr_stream *xdr, const struct nfs_client *client_stateid, struct compound_hdr *hdr)
@@ -1243,6 +1265,7 @@ static void encode_renew(struct xdr_stream *xdr, const struct nfs_client *client
1243 WRITE32(OP_RENEW); 1265 WRITE32(OP_RENEW);
1244 WRITE64(client_stateid->cl_clientid); 1266 WRITE64(client_stateid->cl_clientid);
1245 hdr->nops++; 1267 hdr->nops++;
1268 hdr->replen += decode_renew_maxsz;
1246} 1269}
1247 1270
1248static void 1271static void
@@ -1253,6 +1276,7 @@ encode_restorefh(struct xdr_stream *xdr, struct compound_hdr *hdr)
1253 RESERVE_SPACE(4); 1276 RESERVE_SPACE(4);
1254 WRITE32(OP_RESTOREFH); 1277 WRITE32(OP_RESTOREFH);
1255 hdr->nops++; 1278 hdr->nops++;
1279 hdr->replen += decode_restorefh_maxsz;
1256} 1280}
1257 1281
1258static int 1282static int
@@ -1272,6 +1296,7 @@ encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg, struct compoun
1272 WRITE32(arg->acl_len); 1296 WRITE32(arg->acl_len);
1273 xdr_write_pages(xdr, arg->acl_pages, arg->acl_pgbase, arg->acl_len); 1297 xdr_write_pages(xdr, arg->acl_pages, arg->acl_pgbase, arg->acl_len);
1274 hdr->nops++; 1298 hdr->nops++;
1299 hdr->replen += decode_setacl_maxsz;
1275 return 0; 1300 return 0;
1276} 1301}
1277 1302
@@ -1283,6 +1308,7 @@ encode_savefh(struct xdr_stream *xdr, struct compound_hdr *hdr)
1283 RESERVE_SPACE(4); 1308 RESERVE_SPACE(4);
1284 WRITE32(OP_SAVEFH); 1309 WRITE32(OP_SAVEFH);
1285 hdr->nops++; 1310 hdr->nops++;
1311 hdr->replen += decode_savefh_maxsz;
1286} 1312}
1287 1313
1288static void encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs *arg, const struct nfs_server *server, struct compound_hdr *hdr) 1314static void encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs *arg, const struct nfs_server *server, struct compound_hdr *hdr)
@@ -1293,6 +1319,7 @@ static void encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs
1293 WRITE32(OP_SETATTR); 1319 WRITE32(OP_SETATTR);
1294 WRITEMEM(arg->stateid.data, NFS4_STATEID_SIZE); 1320 WRITEMEM(arg->stateid.data, NFS4_STATEID_SIZE);
1295 hdr->nops++; 1321 hdr->nops++;
1322 hdr->replen += decode_setattr_maxsz;
1296 encode_attrs(xdr, arg->iap, server); 1323 encode_attrs(xdr, arg->iap, server);
1297} 1324}
1298 1325
@@ -1312,6 +1339,7 @@ static void encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclie
1312 RESERVE_SPACE(4); 1339 RESERVE_SPACE(4);
1313 WRITE32(setclientid->sc_cb_ident); 1340 WRITE32(setclientid->sc_cb_ident);
1314 hdr->nops++; 1341 hdr->nops++;
1342 hdr->replen += decode_setclientid_maxsz;
1315} 1343}
1316 1344
1317static void encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_client *client_state, struct compound_hdr *hdr) 1345static void encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_client *client_state, struct compound_hdr *hdr)
@@ -1323,6 +1351,7 @@ static void encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_
1323 WRITE64(client_state->cl_clientid); 1351 WRITE64(client_state->cl_clientid);
1324 WRITEMEM(client_state->cl_confirm.data, NFS4_VERIFIER_SIZE); 1352 WRITEMEM(client_state->cl_confirm.data, NFS4_VERIFIER_SIZE);
1325 hdr->nops++; 1353 hdr->nops++;
1354 hdr->replen += decode_setclientid_confirm_maxsz;
1326} 1355}
1327 1356
1328static void encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *args, struct compound_hdr *hdr) 1357static void encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *args, struct compound_hdr *hdr)
@@ -1341,6 +1370,7 @@ static void encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *arg
1341 1370
1342 xdr_write_pages(xdr, args->pages, args->pgbase, args->count); 1371 xdr_write_pages(xdr, args->pages, args->pgbase, args->count);
1343 hdr->nops++; 1372 hdr->nops++;
1373 hdr->replen += decode_write_maxsz;
1344} 1374}
1345 1375
1346static void encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *stateid, struct compound_hdr *hdr) 1376static void encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *stateid, struct compound_hdr *hdr)
@@ -1352,6 +1382,7 @@ static void encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *state
1352 WRITE32(OP_DELEGRETURN); 1382 WRITE32(OP_DELEGRETURN);
1353 WRITEMEM(stateid->data, NFS4_STATEID_SIZE); 1383 WRITEMEM(stateid->data, NFS4_STATEID_SIZE);
1354 hdr->nops++; 1384 hdr->nops++;
1385 hdr->replen += decode_delegreturn_maxsz;
1355} 1386}
1356/* 1387/*
1357 * END OF "GENERIC" ENCODE ROUTINES. 1388 * END OF "GENERIC" ENCODE ROUTINES.