aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2009-08-14 10:19:13 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-08-14 13:15:20 -0400
commit42edd698125b76a38bd9999015202db036dfbc76 (patch)
tree1a6557173bc670da1010faccee9284dcd9ce2a54 /fs
parent93f0cf25944695e1229fe90a2897af0211fbd425 (diff)
nfs: nfs4xdr: optimize RESERVE_SPACE in encode_create_session and encode_sequence
Coalesce multilpe constant RESERVE_SPACEs into one 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.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 17915c8ea7fa..d460d81758ae 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1562,17 +1562,15 @@ static void encode_create_session(struct xdr_stream *xdr,
1562 uint32_t len; 1562 uint32_t len;
1563 struct nfs_client *clp = args->client; 1563 struct nfs_client *clp = args->client;
1564 1564
1565 RESERVE_SPACE(4); 1565 len = scnprintf(machine_name, sizeof(machine_name), "%s",
1566 *p++ = cpu_to_be32(OP_CREATE_SESSION); 1566 clp->cl_ipaddr);
1567 1567
1568 RESERVE_SPACE(8); 1568 RESERVE_SPACE(20 + 2*28 + 20 + len + 12);
1569 *p++ = cpu_to_be32(OP_CREATE_SESSION);
1569 p = xdr_encode_hyper(p, clp->cl_ex_clid); 1570 p = xdr_encode_hyper(p, clp->cl_ex_clid);
1570
1571 RESERVE_SPACE(8);
1572 *p++ = cpu_to_be32(clp->cl_seqid); /*Sequence id */ 1571 *p++ = cpu_to_be32(clp->cl_seqid); /*Sequence id */
1573 *p++ = cpu_to_be32(args->flags); /*flags */ 1572 *p++ = cpu_to_be32(args->flags); /*flags */
1574 1573
1575 RESERVE_SPACE(2*28); /* 2 channel_attrs */
1576 /* Fore Channel */ 1574 /* Fore Channel */
1577 *p++ = cpu_to_be32(args->fc_attrs.headerpadsz); /* header padding size */ 1575 *p++ = cpu_to_be32(args->fc_attrs.headerpadsz); /* header padding size */
1578 *p++ = cpu_to_be32(args->fc_attrs.max_rqst_sz); /* max req size */ 1576 *p++ = cpu_to_be32(args->fc_attrs.max_rqst_sz); /* max req size */
@@ -1591,21 +1589,12 @@ static void encode_create_session(struct xdr_stream *xdr,
1591 *p++ = cpu_to_be32(args->bc_attrs.max_reqs); /* max requests */ 1589 *p++ = cpu_to_be32(args->bc_attrs.max_reqs); /* max requests */
1592 *p++ = cpu_to_be32(0); /* rdmachannel_attrs */ 1590 *p++ = cpu_to_be32(0); /* rdmachannel_attrs */
1593 1591
1594 RESERVE_SPACE(4);
1595 *p++ = cpu_to_be32(args->cb_program); /* cb_program */ 1592 *p++ = cpu_to_be32(args->cb_program); /* cb_program */
1596
1597 RESERVE_SPACE(4); /* # of security flavors */
1598 *p++ = cpu_to_be32(1); 1593 *p++ = cpu_to_be32(1);
1599
1600 RESERVE_SPACE(4);
1601 *p++ = cpu_to_be32(RPC_AUTH_UNIX); /* auth_sys */ 1594 *p++ = cpu_to_be32(RPC_AUTH_UNIX); /* auth_sys */
1602 1595
1603 /* authsys_parms rfc1831 */ 1596 /* authsys_parms rfc1831 */
1604 RESERVE_SPACE(4);
1605 *p++ = cpu_to_be32((u32)clp->cl_boot_time.tv_nsec); /* stamp */ 1597 *p++ = cpu_to_be32((u32)clp->cl_boot_time.tv_nsec); /* stamp */
1606 len = scnprintf(machine_name, sizeof(machine_name), "%s",
1607 clp->cl_ipaddr);
1608 RESERVE_SPACE(16 + len);
1609 *p++ = cpu_to_be32(len); 1598 *p++ = cpu_to_be32(len);
1610 p = xdr_encode_opaque_fixed(p, machine_name, len); 1599 p = xdr_encode_opaque_fixed(p, machine_name, len);
1611 *p++ = cpu_to_be32(0); /* UID */ 1600 *p++ = cpu_to_be32(0); /* UID */
@@ -1646,7 +1635,7 @@ static void encode_sequence(struct xdr_stream *xdr,
1646 WARN_ON(args->sa_slotid == NFS4_MAX_SLOT_TABLE); 1635 WARN_ON(args->sa_slotid == NFS4_MAX_SLOT_TABLE);
1647 slot = tp->slots + args->sa_slotid; 1636 slot = tp->slots + args->sa_slotid;
1648 1637
1649 RESERVE_SPACE(4); 1638 RESERVE_SPACE(4 + NFS4_MAX_SESSIONID_LEN + 16);
1650 *p++ = cpu_to_be32(OP_SEQUENCE); 1639 *p++ = cpu_to_be32(OP_SEQUENCE);
1651 1640
1652 /* 1641 /*
@@ -1661,7 +1650,6 @@ static void encode_sequence(struct xdr_stream *xdr,
1661 ((u32 *)session->sess_id.data)[3], 1650 ((u32 *)session->sess_id.data)[3],
1662 slot->seq_nr, args->sa_slotid, 1651 slot->seq_nr, args->sa_slotid,
1663 tp->highest_used_slotid, args->sa_cache_this); 1652 tp->highest_used_slotid, args->sa_cache_this);
1664 RESERVE_SPACE(NFS4_MAX_SESSIONID_LEN + 16);
1665 p = xdr_encode_opaque_fixed(p, session->sess_id.data, NFS4_MAX_SESSIONID_LEN); 1653 p = xdr_encode_opaque_fixed(p, session->sess_id.data, NFS4_MAX_SESSIONID_LEN);
1666 *p++ = cpu_to_be32(slot->seq_nr); 1654 *p++ = cpu_to_be32(slot->seq_nr);
1667 *p++ = cpu_to_be32(args->sa_slotid); 1655 *p++ = cpu_to_be32(args->sa_slotid);