aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-03-05 11:27:16 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-03-06 10:32:49 -0500
commit475d4ba02c3748b69cc71fa5c11c4b281cac5928 (patch)
tree9f8d3368e12cc73ac095e36f86e19c252dc087cf /fs
parent700195142185c05757cfd27f8070ae0e9e07710b (diff)
NFSv4: More xdr cleanups
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4xdr.c164
1 files changed, 50 insertions, 114 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index f958849cb304..4ea9f50a32f2 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1084,13 +1084,8 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const
1084 1084
1085static void encode_access(struct xdr_stream *xdr, u32 access, struct compound_hdr *hdr) 1085static void encode_access(struct xdr_stream *xdr, u32 access, struct compound_hdr *hdr)
1086{ 1086{
1087 __be32 *p; 1087 encode_op_hdr(xdr, OP_ACCESS, decode_access_maxsz, hdr);
1088 1088 encode_uint32(xdr, access);
1089 p = reserve_space(xdr, 8);
1090 *p++ = cpu_to_be32(OP_ACCESS);
1091 *p = cpu_to_be32(access);
1092 hdr->nops++;
1093 hdr->replen += decode_access_maxsz;
1094} 1089}
1095 1090
1096static void encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg, struct compound_hdr *hdr) 1091static void encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg, struct compound_hdr *hdr)
@@ -1104,21 +1099,18 @@ static void encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *ar
1104{ 1099{
1105 __be32 *p; 1100 __be32 *p;
1106 1101
1107 p = reserve_space(xdr, 16); 1102 encode_op_hdr(xdr, OP_COMMIT, decode_commit_maxsz, hdr);
1108 *p++ = cpu_to_be32(OP_COMMIT); 1103 p = reserve_space(xdr, 12);
1109 p = xdr_encode_hyper(p, args->offset); 1104 p = xdr_encode_hyper(p, args->offset);
1110 *p = cpu_to_be32(args->count); 1105 *p = cpu_to_be32(args->count);
1111 hdr->nops++;
1112 hdr->replen += decode_commit_maxsz;
1113} 1106}
1114 1107
1115static void encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *create, struct compound_hdr *hdr) 1108static void encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *create, struct compound_hdr *hdr)
1116{ 1109{
1117 __be32 *p; 1110 __be32 *p;
1118 1111
1119 p = reserve_space(xdr, 8); 1112 encode_op_hdr(xdr, OP_CREATE, decode_create_maxsz, hdr);
1120 *p++ = cpu_to_be32(OP_CREATE); 1113 encode_uint32(xdr, create->ftype);
1121 *p = cpu_to_be32(create->ftype);
1122 1114
1123 switch (create->ftype) { 1115 switch (create->ftype) {
1124 case NF4LNK: 1116 case NF4LNK:
@@ -1138,9 +1130,6 @@ static void encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *
1138 } 1130 }
1139 1131
1140 encode_string(xdr, create->name->len, create->name->name); 1132 encode_string(xdr, create->name->len, create->name->name);
1141 hdr->nops++;
1142 hdr->replen += decode_create_maxsz;
1143
1144 encode_attrs(xdr, create->attrs, create->server); 1133 encode_attrs(xdr, create->attrs, create->server);
1145} 1134}
1146 1135
@@ -1148,25 +1137,21 @@ static void encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap, struct c
1148{ 1137{
1149 __be32 *p; 1138 __be32 *p;
1150 1139
1151 p = reserve_space(xdr, 12); 1140 encode_op_hdr(xdr, OP_GETATTR, decode_getattr_maxsz, hdr);
1152 *p++ = cpu_to_be32(OP_GETATTR); 1141 p = reserve_space(xdr, 8);
1153 *p++ = cpu_to_be32(1); 1142 *p++ = cpu_to_be32(1);
1154 *p = cpu_to_be32(bitmap); 1143 *p = cpu_to_be32(bitmap);
1155 hdr->nops++;
1156 hdr->replen += decode_getattr_maxsz;
1157} 1144}
1158 1145
1159static void encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0, uint32_t bm1, struct compound_hdr *hdr) 1146static void encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0, uint32_t bm1, struct compound_hdr *hdr)
1160{ 1147{
1161 __be32 *p; 1148 __be32 *p;
1162 1149
1163 p = reserve_space(xdr, 16); 1150 encode_op_hdr(xdr, OP_GETATTR, decode_getattr_maxsz, hdr);
1164 *p++ = cpu_to_be32(OP_GETATTR); 1151 p = reserve_space(xdr, 12);
1165 *p++ = cpu_to_be32(2); 1152 *p++ = cpu_to_be32(2);
1166 *p++ = cpu_to_be32(bm0); 1153 *p++ = cpu_to_be32(bm0);
1167 *p = cpu_to_be32(bm1); 1154 *p = cpu_to_be32(bm1);
1168 hdr->nops++;
1169 hdr->replen += decode_getattr_maxsz;
1170} 1155}
1171 1156
1172static void 1157static void
@@ -1261,8 +1246,8 @@ static void encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args
1261{ 1246{
1262 __be32 *p; 1247 __be32 *p;
1263 1248
1264 p = reserve_space(xdr, 32); 1249 encode_op_hdr(xdr, OP_LOCK, decode_lock_maxsz, hdr);
1265 *p++ = cpu_to_be32(OP_LOCK); 1250 p = reserve_space(xdr, 28);
1266 *p++ = cpu_to_be32(nfs4_lock_type(args->fl, args->block)); 1251 *p++ = cpu_to_be32(nfs4_lock_type(args->fl, args->block));
1267 *p++ = cpu_to_be32(args->reclaim); 1252 *p++ = cpu_to_be32(args->reclaim);
1268 p = xdr_encode_hyper(p, args->fl->fl_start); 1253 p = xdr_encode_hyper(p, args->fl->fl_start);
@@ -1278,38 +1263,31 @@ static void encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args
1278 encode_nfs4_stateid(xdr, args->lock_stateid); 1263 encode_nfs4_stateid(xdr, args->lock_stateid);
1279 encode_nfs4_seqid(xdr, args->lock_seqid); 1264 encode_nfs4_seqid(xdr, args->lock_seqid);
1280 } 1265 }
1281 hdr->nops++;
1282 hdr->replen += decode_lock_maxsz;
1283} 1266}
1284 1267
1285static void encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *args, struct compound_hdr *hdr) 1268static void encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *args, struct compound_hdr *hdr)
1286{ 1269{
1287 __be32 *p; 1270 __be32 *p;
1288 1271
1289 p = reserve_space(xdr, 24); 1272 encode_op_hdr(xdr, OP_LOCKT, decode_lockt_maxsz, hdr);
1290 *p++ = cpu_to_be32(OP_LOCKT); 1273 p = reserve_space(xdr, 20);
1291 *p++ = cpu_to_be32(nfs4_lock_type(args->fl, 0)); 1274 *p++ = cpu_to_be32(nfs4_lock_type(args->fl, 0));
1292 p = xdr_encode_hyper(p, args->fl->fl_start); 1275 p = xdr_encode_hyper(p, args->fl->fl_start);
1293 p = xdr_encode_hyper(p, nfs4_lock_length(args->fl)); 1276 p = xdr_encode_hyper(p, nfs4_lock_length(args->fl));
1294 encode_lockowner(xdr, &args->lock_owner); 1277 encode_lockowner(xdr, &args->lock_owner);
1295 hdr->nops++;
1296 hdr->replen += decode_lockt_maxsz;
1297} 1278}
1298 1279
1299static void encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *args, struct compound_hdr *hdr) 1280static void encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *args, struct compound_hdr *hdr)
1300{ 1281{
1301 __be32 *p; 1282 __be32 *p;
1302 1283
1303 p = reserve_space(xdr, 8); 1284 encode_op_hdr(xdr, OP_LOCKU, decode_locku_maxsz, hdr);
1304 *p++ = cpu_to_be32(OP_LOCKU); 1285 encode_uint32(xdr, nfs4_lock_type(args->fl, 0));
1305 *p = cpu_to_be32(nfs4_lock_type(args->fl, 0));
1306 encode_nfs4_seqid(xdr, args->seqid); 1286 encode_nfs4_seqid(xdr, args->seqid);
1307 encode_nfs4_stateid(xdr, args->stateid); 1287 encode_nfs4_stateid(xdr, args->stateid);
1308 p = reserve_space(xdr, 16); 1288 p = reserve_space(xdr, 16);
1309 p = xdr_encode_hyper(p, args->fl->fl_start); 1289 p = xdr_encode_hyper(p, args->fl->fl_start);
1310 xdr_encode_hyper(p, nfs4_lock_length(args->fl)); 1290 xdr_encode_hyper(p, nfs4_lock_length(args->fl));
1311 hdr->nops++;
1312 hdr->replen += decode_locku_maxsz;
1313} 1291}
1314 1292
1315static void encode_release_lockowner(struct xdr_stream *xdr, const struct nfs_lowner *lowner, struct compound_hdr *hdr) 1293static void encode_release_lockowner(struct xdr_stream *xdr, const struct nfs_lowner *lowner, struct compound_hdr *hdr)
@@ -1553,8 +1531,8 @@ static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg
1553 if (!(readdir->bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID)) 1531 if (!(readdir->bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID))
1554 attrs[0] |= FATTR4_WORD0_FILEID; 1532 attrs[0] |= FATTR4_WORD0_FILEID;
1555 1533
1556 p = reserve_space(xdr, 12); 1534 encode_op_hdr(xdr, OP_READDIR, decode_readdir_maxsz, hdr);
1557 *p++ = cpu_to_be32(OP_READDIR); 1535 p = reserve_space(xdr, 8);
1558 p = xdr_encode_hyper(p, readdir->cookie); 1536 p = xdr_encode_hyper(p, readdir->cookie);
1559 encode_nfs4_verifier(xdr, &readdir->verifier); 1537 encode_nfs4_verifier(xdr, &readdir->verifier);
1560 p = reserve_space(xdr, 20); 1538 p = reserve_space(xdr, 20);
@@ -1564,8 +1542,6 @@ static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg
1564 1542
1565 *p++ = cpu_to_be32(attrs[0] & readdir->bitmask[0]); 1543 *p++ = cpu_to_be32(attrs[0] & readdir->bitmask[0]);
1566 *p = cpu_to_be32(attrs[1] & readdir->bitmask[1]); 1544 *p = cpu_to_be32(attrs[1] & readdir->bitmask[1]);
1567 hdr->nops++;
1568 hdr->replen += decode_readdir_maxsz;
1569 memcpy(verf, readdir->verifier.data, sizeof(verf)); 1545 memcpy(verf, readdir->verifier.data, sizeof(verf));
1570 dprintk("%s: cookie = %Lu, verifier = %08x:%08x, bitmap = %08x:%08x\n", 1546 dprintk("%s: cookie = %Lu, verifier = %08x:%08x, bitmap = %08x:%08x\n",
1571 __func__, 1547 __func__,
@@ -1598,11 +1574,9 @@ static void encode_renew(struct xdr_stream *xdr, clientid4 clid,
1598{ 1574{
1599 __be32 *p; 1575 __be32 *p;
1600 1576
1601 p = reserve_space(xdr, 12); 1577 encode_op_hdr(xdr, OP_RENEW, decode_renew_maxsz, hdr);
1602 *p++ = cpu_to_be32(OP_RENEW); 1578 p = reserve_space(xdr, 8);
1603 xdr_encode_hyper(p, clid); 1579 xdr_encode_hyper(p, clid);
1604 hdr->nops++;
1605 hdr->replen += decode_renew_maxsz;
1606} 1580}
1607 1581
1608static void 1582static void
@@ -1660,12 +1634,11 @@ static void encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs4
1660{ 1634{
1661 __be32 *p; 1635 __be32 *p;
1662 1636
1663 p = reserve_space(xdr, 12); 1637 encode_op_hdr(xdr, OP_SETCLIENTID_CONFIRM,
1664 *p++ = cpu_to_be32(OP_SETCLIENTID_CONFIRM); 1638 decode_setclientid_confirm_maxsz, hdr);
1639 p = reserve_space(xdr, 8);
1665 p = xdr_encode_hyper(p, arg->clientid); 1640 p = xdr_encode_hyper(p, arg->clientid);
1666 encode_nfs4_verifier(xdr, &arg->confirm); 1641 encode_nfs4_verifier(xdr, &arg->confirm);
1667 hdr->nops++;
1668 hdr->replen += decode_setclientid_confirm_maxsz;
1669} 1642}
1670 1643
1671static void encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *args, struct compound_hdr *hdr) 1644static void encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *args, struct compound_hdr *hdr)
@@ -1758,8 +1731,8 @@ static void encode_create_session(struct xdr_stream *xdr,
1758 len = scnprintf(machine_name, sizeof(machine_name), "%s", 1731 len = scnprintf(machine_name, sizeof(machine_name), "%s",
1759 clp->cl_ipaddr); 1732 clp->cl_ipaddr);
1760 1733
1761 p = reserve_space(xdr, 20 + 2*28 + 20 + len + 12); 1734 encode_op_hdr(xdr, OP_CREATE_SESSION, decode_create_session_maxsz, hdr);
1762 *p++ = cpu_to_be32(OP_CREATE_SESSION); 1735 p = reserve_space(xdr, 16 + 2*28 + 20 + len + 12);
1763 p = xdr_encode_hyper(p, clp->cl_clientid); 1736 p = xdr_encode_hyper(p, clp->cl_clientid);
1764 *p++ = cpu_to_be32(clp->cl_seqid); /*Sequence id */ 1737 *p++ = cpu_to_be32(clp->cl_seqid); /*Sequence id */
1765 *p++ = cpu_to_be32(args->flags); /*flags */ 1738 *p++ = cpu_to_be32(args->flags); /*flags */
@@ -1792,33 +1765,22 @@ static void encode_create_session(struct xdr_stream *xdr,
1792 *p++ = cpu_to_be32(0); /* UID */ 1765 *p++ = cpu_to_be32(0); /* UID */
1793 *p++ = cpu_to_be32(0); /* GID */ 1766 *p++ = cpu_to_be32(0); /* GID */
1794 *p = cpu_to_be32(0); /* No more gids */ 1767 *p = cpu_to_be32(0); /* No more gids */
1795 hdr->nops++;
1796 hdr->replen += decode_create_session_maxsz;
1797} 1768}
1798 1769
1799static void encode_destroy_session(struct xdr_stream *xdr, 1770static void encode_destroy_session(struct xdr_stream *xdr,
1800 struct nfs4_session *session, 1771 struct nfs4_session *session,
1801 struct compound_hdr *hdr) 1772 struct compound_hdr *hdr)
1802{ 1773{
1803 __be32 *p; 1774 encode_op_hdr(xdr, OP_DESTROY_SESSION, decode_destroy_session_maxsz, hdr);
1804 p = reserve_space(xdr, 4 + NFS4_MAX_SESSIONID_LEN); 1775 encode_opaque_fixed(xdr, session->sess_id.data, NFS4_MAX_SESSIONID_LEN);
1805 *p++ = cpu_to_be32(OP_DESTROY_SESSION);
1806 xdr_encode_opaque_fixed(p, session->sess_id.data, NFS4_MAX_SESSIONID_LEN);
1807 hdr->nops++;
1808 hdr->replen += decode_destroy_session_maxsz;
1809} 1776}
1810 1777
1811static void encode_reclaim_complete(struct xdr_stream *xdr, 1778static void encode_reclaim_complete(struct xdr_stream *xdr,
1812 struct nfs41_reclaim_complete_args *args, 1779 struct nfs41_reclaim_complete_args *args,
1813 struct compound_hdr *hdr) 1780 struct compound_hdr *hdr)
1814{ 1781{
1815 __be32 *p; 1782 encode_op_hdr(xdr, OP_RECLAIM_COMPLETE, decode_reclaim_complete_maxsz, hdr);
1816 1783 encode_uint32(xdr, args->one_fs);
1817 p = reserve_space(xdr, 8);
1818 *p++ = cpu_to_be32(OP_RECLAIM_COMPLETE);
1819 *p++ = cpu_to_be32(args->one_fs);
1820 hdr->nops++;
1821 hdr->replen += decode_reclaim_complete_maxsz;
1822} 1784}
1823#endif /* CONFIG_NFS_V4_1 */ 1785#endif /* CONFIG_NFS_V4_1 */
1824 1786
@@ -1840,8 +1802,7 @@ static void encode_sequence(struct xdr_stream *xdr,
1840 WARN_ON(args->sa_slotid == NFS4_MAX_SLOT_TABLE); 1802 WARN_ON(args->sa_slotid == NFS4_MAX_SLOT_TABLE);
1841 slot = tp->slots + args->sa_slotid; 1803 slot = tp->slots + args->sa_slotid;
1842 1804
1843 p = reserve_space(xdr, 4 + NFS4_MAX_SESSIONID_LEN + 16); 1805 encode_op_hdr(xdr, OP_SEQUENCE, decode_sequence_maxsz, hdr);
1844 *p++ = cpu_to_be32(OP_SEQUENCE);
1845 1806
1846 /* 1807 /*
1847 * Sessionid + seqid + slotid + max slotid + cache_this 1808 * Sessionid + seqid + slotid + max slotid + cache_this
@@ -1855,13 +1816,12 @@ static void encode_sequence(struct xdr_stream *xdr,
1855 ((u32 *)session->sess_id.data)[3], 1816 ((u32 *)session->sess_id.data)[3],
1856 slot->seq_nr, args->sa_slotid, 1817 slot->seq_nr, args->sa_slotid,
1857 tp->highest_used_slotid, args->sa_cache_this); 1818 tp->highest_used_slotid, args->sa_cache_this);
1819 p = reserve_space(xdr, NFS4_MAX_SESSIONID_LEN + 16);
1858 p = xdr_encode_opaque_fixed(p, session->sess_id.data, NFS4_MAX_SESSIONID_LEN); 1820 p = xdr_encode_opaque_fixed(p, session->sess_id.data, NFS4_MAX_SESSIONID_LEN);
1859 *p++ = cpu_to_be32(slot->seq_nr); 1821 *p++ = cpu_to_be32(slot->seq_nr);
1860 *p++ = cpu_to_be32(args->sa_slotid); 1822 *p++ = cpu_to_be32(args->sa_slotid);
1861 *p++ = cpu_to_be32(tp->highest_used_slotid); 1823 *p++ = cpu_to_be32(tp->highest_used_slotid);
1862 *p = cpu_to_be32(args->sa_cache_this); 1824 *p = cpu_to_be32(args->sa_cache_this);
1863 hdr->nops++;
1864 hdr->replen += decode_sequence_maxsz;
1865#endif /* CONFIG_NFS_V4_1 */ 1825#endif /* CONFIG_NFS_V4_1 */
1866} 1826}
1867 1827
@@ -1876,14 +1836,12 @@ encode_getdevicelist(struct xdr_stream *xdr,
1876 .data = "dummmmmy", 1836 .data = "dummmmmy",
1877 }; 1837 };
1878 1838
1879 p = reserve_space(xdr, 20); 1839 encode_op_hdr(xdr, OP_GETDEVICELIST, decode_getdevicelist_maxsz, hdr);
1880 *p++ = cpu_to_be32(OP_GETDEVICELIST); 1840 p = reserve_space(xdr, 16);
1881 *p++ = cpu_to_be32(args->layoutclass); 1841 *p++ = cpu_to_be32(args->layoutclass);
1882 *p++ = cpu_to_be32(NFS4_PNFS_GETDEVLIST_MAXNUM); 1842 *p++ = cpu_to_be32(NFS4_PNFS_GETDEVLIST_MAXNUM);
1883 xdr_encode_hyper(p, 0ULL); /* cookie */ 1843 xdr_encode_hyper(p, 0ULL); /* cookie */
1884 encode_nfs4_verifier(xdr, &dummy); 1844 encode_nfs4_verifier(xdr, &dummy);
1885 hdr->nops++;
1886 hdr->replen += decode_getdevicelist_maxsz;
1887} 1845}
1888 1846
1889static void 1847static void
@@ -1893,15 +1851,13 @@ encode_getdeviceinfo(struct xdr_stream *xdr,
1893{ 1851{
1894 __be32 *p; 1852 __be32 *p;
1895 1853
1896 p = reserve_space(xdr, 16 + NFS4_DEVICEID4_SIZE); 1854 encode_op_hdr(xdr, OP_GETDEVICEINFO, decode_getdeviceinfo_maxsz, hdr);
1897 *p++ = cpu_to_be32(OP_GETDEVICEINFO); 1855 p = reserve_space(xdr, 12 + NFS4_DEVICEID4_SIZE);
1898 p = xdr_encode_opaque_fixed(p, args->pdev->dev_id.data, 1856 p = xdr_encode_opaque_fixed(p, args->pdev->dev_id.data,
1899 NFS4_DEVICEID4_SIZE); 1857 NFS4_DEVICEID4_SIZE);
1900 *p++ = cpu_to_be32(args->pdev->layout_type); 1858 *p++ = cpu_to_be32(args->pdev->layout_type);
1901 *p++ = cpu_to_be32(args->pdev->pglen); /* gdia_maxcount */ 1859 *p++ = cpu_to_be32(args->pdev->pglen); /* gdia_maxcount */
1902 *p++ = cpu_to_be32(0); /* bitmap length 0 */ 1860 *p++ = cpu_to_be32(0); /* bitmap length 0 */
1903 hdr->nops++;
1904 hdr->replen += decode_getdeviceinfo_maxsz;
1905} 1861}
1906 1862
1907static void 1863static void
@@ -1911,8 +1867,8 @@ encode_layoutget(struct xdr_stream *xdr,
1911{ 1867{
1912 __be32 *p; 1868 __be32 *p;
1913 1869
1914 p = reserve_space(xdr, 40); 1870 encode_op_hdr(xdr, OP_LAYOUTGET, decode_layoutget_maxsz, hdr);
1915 *p++ = cpu_to_be32(OP_LAYOUTGET); 1871 p = reserve_space(xdr, 36);
1916 *p++ = cpu_to_be32(0); /* Signal layout available */ 1872 *p++ = cpu_to_be32(0); /* Signal layout available */
1917 *p++ = cpu_to_be32(args->type); 1873 *p++ = cpu_to_be32(args->type);
1918 *p++ = cpu_to_be32(args->range.iomode); 1874 *p++ = cpu_to_be32(args->range.iomode);
@@ -1920,8 +1876,7 @@ encode_layoutget(struct xdr_stream *xdr,
1920 p = xdr_encode_hyper(p, args->range.length); 1876 p = xdr_encode_hyper(p, args->range.length);
1921 p = xdr_encode_hyper(p, args->minlength); 1877 p = xdr_encode_hyper(p, args->minlength);
1922 encode_nfs4_stateid(xdr, &args->stateid); 1878 encode_nfs4_stateid(xdr, &args->stateid);
1923 p = reserve_space(xdr, 4); 1879 encode_uint32(xdr, args->maxcount);
1924 *p = cpu_to_be32(args->maxcount);
1925 1880
1926 dprintk("%s: 1st type:0x%x iomode:%d off:%lu len:%lu mc:%d\n", 1881 dprintk("%s: 1st type:0x%x iomode:%d off:%lu len:%lu mc:%d\n",
1927 __func__, 1882 __func__,
@@ -1930,8 +1885,6 @@ encode_layoutget(struct xdr_stream *xdr,
1930 (unsigned long)args->range.offset, 1885 (unsigned long)args->range.offset,
1931 (unsigned long)args->range.length, 1886 (unsigned long)args->range.length,
1932 args->maxcount); 1887 args->maxcount);
1933 hdr->nops++;
1934 hdr->replen += decode_layoutget_maxsz;
1935} 1888}
1936 1889
1937static int 1890static int
@@ -1945,8 +1898,8 @@ encode_layoutcommit(struct xdr_stream *xdr,
1945 dprintk("%s: lbw: %llu type: %d\n", __func__, args->lastbytewritten, 1898 dprintk("%s: lbw: %llu type: %d\n", __func__, args->lastbytewritten,
1946 NFS_SERVER(args->inode)->pnfs_curr_ld->id); 1899 NFS_SERVER(args->inode)->pnfs_curr_ld->id);
1947 1900
1948 p = reserve_space(xdr, 24); 1901 encode_op_hdr(xdr, OP_LAYOUTCOMMIT, decode_layoutcommit_maxsz, hdr);
1949 *p++ = cpu_to_be32(OP_LAYOUTCOMMIT); 1902 p = reserve_space(xdr, 20);
1950 /* Only whole file layouts */ 1903 /* Only whole file layouts */
1951 p = xdr_encode_hyper(p, 0); /* offset */ 1904 p = xdr_encode_hyper(p, 0); /* offset */
1952 p = xdr_encode_hyper(p, args->lastbytewritten + 1); /* length */ 1905 p = xdr_encode_hyper(p, args->lastbytewritten + 1); /* length */
@@ -1961,13 +1914,9 @@ encode_layoutcommit(struct xdr_stream *xdr,
1961 if (NFS_SERVER(inode)->pnfs_curr_ld->encode_layoutcommit) 1914 if (NFS_SERVER(inode)->pnfs_curr_ld->encode_layoutcommit)
1962 NFS_SERVER(inode)->pnfs_curr_ld->encode_layoutcommit( 1915 NFS_SERVER(inode)->pnfs_curr_ld->encode_layoutcommit(
1963 NFS_I(inode)->layout, xdr, args); 1916 NFS_I(inode)->layout, xdr, args);
1964 else { 1917 else
1965 p = reserve_space(xdr, 4); 1918 encode_uint32(xdr, 0); /* no layout-type payload */
1966 *p = cpu_to_be32(0); /* no layout-type payload */
1967 }
1968 1919
1969 hdr->nops++;
1970 hdr->replen += decode_layoutcommit_maxsz;
1971 return 0; 1920 return 0;
1972} 1921}
1973 1922
@@ -1978,8 +1927,8 @@ encode_layoutreturn(struct xdr_stream *xdr,
1978{ 1927{
1979 __be32 *p; 1928 __be32 *p;
1980 1929
1981 p = reserve_space(xdr, 20); 1930 encode_op_hdr(xdr, OP_LAYOUTRETURN, decode_layoutreturn_maxsz, hdr);
1982 *p++ = cpu_to_be32(OP_LAYOUTRETURN); 1931 p = reserve_space(xdr, 16);
1983 *p++ = cpu_to_be32(0); /* reclaim. always 0 for now */ 1932 *p++ = cpu_to_be32(0); /* reclaim. always 0 for now */
1984 *p++ = cpu_to_be32(args->layout_type); 1933 *p++ = cpu_to_be32(args->layout_type);
1985 *p++ = cpu_to_be32(IOMODE_ANY); 1934 *p++ = cpu_to_be32(IOMODE_ANY);
@@ -1993,12 +1942,8 @@ encode_layoutreturn(struct xdr_stream *xdr,
1993 if (NFS_SERVER(args->inode)->pnfs_curr_ld->encode_layoutreturn) { 1942 if (NFS_SERVER(args->inode)->pnfs_curr_ld->encode_layoutreturn) {
1994 NFS_SERVER(args->inode)->pnfs_curr_ld->encode_layoutreturn( 1943 NFS_SERVER(args->inode)->pnfs_curr_ld->encode_layoutreturn(
1995 NFS_I(args->inode)->layout, xdr, args); 1944 NFS_I(args->inode)->layout, xdr, args);
1996 } else { 1945 } else
1997 p = reserve_space(xdr, 4); 1946 encode_uint32(xdr, 0);
1998 *p = cpu_to_be32(0);
1999 }
2000 hdr->nops++;
2001 hdr->replen += decode_layoutreturn_maxsz;
2002} 1947}
2003 1948
2004static int 1949static int
@@ -2006,12 +1951,8 @@ encode_secinfo_no_name(struct xdr_stream *xdr,
2006 const struct nfs41_secinfo_no_name_args *args, 1951 const struct nfs41_secinfo_no_name_args *args,
2007 struct compound_hdr *hdr) 1952 struct compound_hdr *hdr)
2008{ 1953{
2009 __be32 *p; 1954 encode_op_hdr(xdr, OP_SECINFO_NO_NAME, decode_secinfo_no_name_maxsz, hdr);
2010 p = reserve_space(xdr, 8); 1955 encode_uint32(xdr, args->style);
2011 *p++ = cpu_to_be32(OP_SECINFO_NO_NAME);
2012 *p++ = cpu_to_be32(args->style);
2013 hdr->nops++;
2014 hdr->replen += decode_secinfo_no_name_maxsz;
2015 return 0; 1956 return 0;
2016} 1957}
2017 1958
@@ -2019,14 +1960,9 @@ static void encode_test_stateid(struct xdr_stream *xdr,
2019 struct nfs41_test_stateid_args *args, 1960 struct nfs41_test_stateid_args *args,
2020 struct compound_hdr *hdr) 1961 struct compound_hdr *hdr)
2021{ 1962{
2022 __be32 *p; 1963 encode_op_hdr(xdr, OP_TEST_STATEID, decode_test_stateid_maxsz, hdr);
2023 1964 encode_uint32(xdr, 1);
2024 p = reserve_space(xdr, 8);
2025 *p++ = cpu_to_be32(OP_TEST_STATEID);
2026 *p = cpu_to_be32(1);
2027 encode_nfs4_stateid(xdr, args->stateid); 1965 encode_nfs4_stateid(xdr, args->stateid);
2028 hdr->nops++;
2029 hdr->replen += decode_test_stateid_maxsz;
2030} 1966}
2031 1967
2032static void encode_free_stateid(struct xdr_stream *xdr, 1968static void encode_free_stateid(struct xdr_stream *xdr,