]> Pileus Git - ~andy/linux/commitdiff
NFSv4.1: Label each entry in the session slot tables with its slot number
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 16 Nov 2012 17:45:06 +0000 (12:45 -0500)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 26 Nov 2012 22:49:51 +0000 (17:49 -0500)
Instead of doing slot table pointer gymnastics every time we want to
know which slot we're using.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/nfs4proc.c
fs/nfs/nfs4xdr.c
include/linux/nfs_xdr.h

index 5b61c4a83191203e94aaaf14dcf385cb56a205d8..4311dba49c58f9158a5b7d5ff38145c22d2a486c 100644 (file)
@@ -526,9 +526,9 @@ static int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *
                 * returned NFS4ERR_DELAY as per Section 2.10.6.2
                 * of RFC5661.
                 */
-               dprintk("%s: slot=%td seq=%d: Operation in progress\n",
+               dprintk("%s: slot=%u seq=%u: Operation in progress\n",
                        __func__,
-                       slot - session->fc_slot_table.slots,
+                       slot->slot_nr,
                        slot->seq_nr);
                goto out_retry;
        default:
@@ -671,9 +671,9 @@ int nfs4_setup_sequence(const struct nfs_server *server,
        if (session == NULL)
                goto out;
 
-       dprintk("--> %s clp %p session %p sr_slot %td\n",
+       dprintk("--> %s clp %p session %p sr_slot %d\n",
                __func__, session->clp, session, res->sr_slot ?
-                       res->sr_slot - session->fc_slot_table.slots : -1);
+                       res->sr_slot->slot_nr : -1);
 
        ret = nfs41_setup_sequence(session, args, res, task);
 out:
@@ -5669,8 +5669,10 @@ struct nfs4_slot *nfs4_alloc_slots(struct nfs4_slot_table *table,
 
        tbl = kmalloc_array(max_slots, sizeof(*tbl), gfp_flags);
        if (tbl != NULL) {
-               for (i = 0; i < max_slots; i++)
+               for (i = 0; i < max_slots; i++) {
                        tbl[i].table = table;
+                       tbl[i].slot_nr = i;
+               }
        }
        return tbl;
 }
index 4126f054610a7141ad31a54024b6e1328eb98174..50bac70661601f55e533f5693007a429495bf68d 100644 (file)
@@ -5547,7 +5547,7 @@ static int decode_sequence(struct xdr_stream *xdr,
        }
        /* slot id */
        dummy = be32_to_cpup(p++);
-       if (dummy != res->sr_slot - session->fc_slot_table.slots) {
+       if (dummy != res->sr_slot->slot_nr) {
                dprintk("%s Invalid slot id\n", __func__);
                goto out_err;
        }
index 0fd88ab0e8143156b2188accf8fac38210269e28..9c9b76c94b46086b76e779d947555120c5a0845b 100644 (file)
@@ -189,6 +189,7 @@ struct nfs4_channel_attrs {
 struct nfs4_slot {
        struct nfs4_slot_table  *table;
        unsigned long           renewal_time;
+       u32                     slot_nr;
        u32                     seq_nr;
 };