Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b2fa717 authored by Trond Myklebust's avatar Trond Myklebust
Browse files

NFSv4.1: Simplify struct nfs4_sequence_args too



Replace the session pointer + slotid with a pointer to the
allocated slot.

Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent df2fabff
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -591,7 +591,7 @@ nfs4_find_slot(struct nfs4_slot_table *tbl)
static void nfs41_init_sequence(struct nfs4_sequence_args *args,
static void nfs41_init_sequence(struct nfs4_sequence_args *args,
		struct nfs4_sequence_res *res, int cache_reply)
		struct nfs4_sequence_res *res, int cache_reply)
{
{
	args->sa_session = NULL;
	args->sa_slot = NULL;
	args->sa_cache_this = 0;
	args->sa_cache_this = 0;
	if (cache_reply)
	if (cache_reply)
		args->sa_cache_this = 1;
		args->sa_cache_this = 1;
@@ -644,8 +644,8 @@ int nfs41_setup_sequence(struct nfs4_session *session,
	rpc_task_set_priority(task, RPC_PRIORITY_NORMAL);
	rpc_task_set_priority(task, RPC_PRIORITY_NORMAL);
	slot = tbl->slots + slotid;
	slot = tbl->slots + slotid;
	slot->renewal_time = jiffies;
	slot->renewal_time = jiffies;
	args->sa_session = session;

	args->sa_slotid = slotid;
	args->sa_slot = slot;


	dprintk("<-- %s slotid=%d seqid=%d\n", __func__, slotid, slot->seq_nr);
	dprintk("<-- %s slotid=%d seqid=%d\n", __func__, slotid, slot->seq_nr);


+10 −11
Original line number Original line Diff line number Diff line
@@ -1833,18 +1833,16 @@ static void encode_sequence(struct xdr_stream *xdr,
			    struct compound_hdr *hdr)
			    struct compound_hdr *hdr)
{
{
#if defined(CONFIG_NFS_V4_1)
#if defined(CONFIG_NFS_V4_1)
	struct nfs4_session *session = args->sa_session;
	struct nfs4_session *session;
	struct nfs4_slot_table *tp;
	struct nfs4_slot_table *tp;
	struct nfs4_slot *slot;
	struct nfs4_slot *slot = args->sa_slot;
	__be32 *p;
	__be32 *p;


	if (!session)
	if (slot == NULL)
		return;
		return;


	tp = &session->fc_slot_table;
	tp = slot->table;

	session = tp->session;
	WARN_ON(args->sa_slotid == NFS4_MAX_SLOT_TABLE);
	slot = tp->slots + args->sa_slotid;


	encode_op_hdr(xdr, OP_SEQUENCE, decode_sequence_maxsz, hdr);
	encode_op_hdr(xdr, OP_SEQUENCE, decode_sequence_maxsz, hdr);


@@ -1858,12 +1856,12 @@ static void encode_sequence(struct xdr_stream *xdr,
		((u32 *)session->sess_id.data)[1],
		((u32 *)session->sess_id.data)[1],
		((u32 *)session->sess_id.data)[2],
		((u32 *)session->sess_id.data)[2],
		((u32 *)session->sess_id.data)[3],
		((u32 *)session->sess_id.data)[3],
		slot->seq_nr, args->sa_slotid,
		slot->seq_nr, slot->slot_nr,
		tp->highest_used_slotid, args->sa_cache_this);
		tp->highest_used_slotid, args->sa_cache_this);
	p = reserve_space(xdr, NFS4_MAX_SESSIONID_LEN + 16);
	p = reserve_space(xdr, NFS4_MAX_SESSIONID_LEN + 16);
	p = xdr_encode_opaque_fixed(p, session->sess_id.data, NFS4_MAX_SESSIONID_LEN);
	p = xdr_encode_opaque_fixed(p, session->sess_id.data, NFS4_MAX_SESSIONID_LEN);
	*p++ = cpu_to_be32(slot->seq_nr);
	*p++ = cpu_to_be32(slot->seq_nr);
	*p++ = cpu_to_be32(args->sa_slotid);
	*p++ = cpu_to_be32(slot->slot_nr);
	*p++ = cpu_to_be32(tp->highest_used_slotid);
	*p++ = cpu_to_be32(tp->highest_used_slotid);
	*p = cpu_to_be32(args->sa_cache_this);
	*p = cpu_to_be32(args->sa_cache_this);
#endif /* CONFIG_NFS_V4_1 */
#endif /* CONFIG_NFS_V4_1 */
@@ -2025,8 +2023,9 @@ static void encode_free_stateid(struct xdr_stream *xdr,
static u32 nfs4_xdr_minorversion(const struct nfs4_sequence_args *args)
static u32 nfs4_xdr_minorversion(const struct nfs4_sequence_args *args)
{
{
#if defined(CONFIG_NFS_V4_1)
#if defined(CONFIG_NFS_V4_1)
	if (args->sa_session)

		return args->sa_session->clp->cl_mvops->minor_version;
	if (args->sa_slot)
		return args->sa_slot->table->session->clp->cl_mvops->minor_version;
#endif /* CONFIG_NFS_V4_1 */
#endif /* CONFIG_NFS_V4_1 */
	return 0;
	return 0;
}
}
+1 −2
Original line number Original line Diff line number Diff line
@@ -194,8 +194,7 @@ struct nfs4_slot {
};
};


struct nfs4_sequence_args {
struct nfs4_sequence_args {
	struct nfs4_session	*sa_session;
	struct nfs4_slot	*sa_slot;
	u32			sa_slotid;
	u8			sa_cache_this;
	u8			sa_cache_this;
};
};