]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
nfsd4: rearrange struct nfsd4_slot
authorJ. Bruce Fields <bfields@redhat.com>
Mon, 13 Feb 2012 21:39:00 +0000 (16:39 -0500)
committerJ. Bruce Fields <bfields@redhat.com>
Tue, 14 Feb 2012 22:01:29 +0000 (17:01 -0500)
Combine two booleans into a single flag field, move the smaller fields
to the end.

(In practice this doesn't make the struct any smaller.  But we'll be
adding another flag here soon.)

Remove some debugging code that doesn't look useful, while we're in the
neighborhood.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4state.c
fs/nfsd/nfs4xdr.c
fs/nfsd/state.h
fs/nfsd/xdr4.h

index 2095dbb2923ea2427832d02e3290d1ba72a768ae..e0e706f8918d2270ca031e83ef04a984205c4cb3 100644 (file)
@@ -1374,15 +1374,12 @@ nfsd4_enc_sequence_replay(struct nfsd4_compoundargs *args,
        struct nfsd4_op *op;
        struct nfsd4_slot *slot = resp->cstate.slot;
 
-       dprintk("--> %s resp->opcnt %d cachethis %u \n", __func__,
-               resp->opcnt, resp->cstate.slot->sl_cachethis);
-
        /* Encode the replayed sequence operation */
        op = &args->ops[resp->opcnt - 1];
        nfsd4_encode_operation(resp, op);
 
        /* Return nfserr_retry_uncached_rep in next operation. */
-       if (args->opcnt > 1 && slot->sl_cachethis == 0) {
+       if (args->opcnt > 1 && !(slot->sl_flags & NFSD4_SLOT_CACHETHIS)) {
                op = &args->ops[resp->opcnt++];
                op->status = nfserr_retry_uncached_rep;
                nfsd4_encode_operation(resp, op);
@@ -1916,7 +1913,8 @@ nfsd4_sequence(struct svc_rqst *rqstp,
         * sr_highest_slotid and the sr_target_slot id to maxslots */
        seq->maxslots = session->se_fchannel.maxreqs;
 
-       status = check_slot_seqid(seq->seqid, slot->sl_seqid, slot->sl_inuse);
+       status = check_slot_seqid(seq->seqid, slot->sl_seqid,
+                                       slot->sl_flags & NFSD4_SLOT_INUSE);
        if (status == nfserr_replay_cache) {
                cstate->slot = slot;
                cstate->session = session;
@@ -1933,9 +1931,10 @@ nfsd4_sequence(struct svc_rqst *rqstp,
        conn = NULL;
 
        /* Success! bump slot seqid */
-       slot->sl_inuse = true;
        slot->sl_seqid = seq->seqid;
-       slot->sl_cachethis = seq->cachethis;
+       slot->sl_flags = NFSD4_SLOT_INUSE;
+       if (seq->cachethis)
+               slot->sl_flags |= NFSD4_SLOT_CACHETHIS;
 
        cstate->slot = slot;
        cstate->session = session;
index 0ec5a1b9700e5e8d59196cfa387f608aa5c7f0ce..279a70548e47bf47d7f9aa1a991128339d24883d 100644 (file)
@@ -3532,7 +3532,7 @@ int nfsd4_check_resp_size(struct nfsd4_compoundres *resp, u32 pad)
        if (length > session->se_fchannel.maxresp_sz)
                return nfserr_rep_too_big;
 
-       if (slot->sl_cachethis == 1 &&
+       if ((slot->sl_flags & NFSD4_SLOT_CACHETHIS) &&
            length > session->se_fchannel.maxresp_cached)
                return nfserr_rep_too_big_to_cache;
 
@@ -3656,8 +3656,7 @@ nfs4svc_encode_compoundres(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compo
        if (nfsd4_has_session(cs)) {
                if (cs->status != nfserr_replay_cache) {
                        nfsd4_store_cache_entry(resp);
-                       dprintk("%s: SET SLOT STATE TO AVAILABLE\n", __func__);
-                       cs->slot->sl_inuse = false;
+                       cs->slot->sl_flags &= ~NFSD4_SLOT_INUSE;
                }
                /* Renew the clientid on success and on replay */
                release_session_client(cs->session);
index ffb5df1db94ff86558aff1340a6b07af2af29b79..122217fe9155b188aa3c7a5a4c2f176891c3427b 100644 (file)
@@ -128,12 +128,13 @@ static inline struct nfs4_delegation *delegstateid(struct nfs4_stid *s)
                (NFSD_CACHE_SIZE_SLOTS_PER_SESSION * NFSD_SLOT_CACHE_SIZE)
 
 struct nfsd4_slot {
-       bool    sl_inuse;
-       bool    sl_cachethis;
-       u16     sl_opcnt;
        u32     sl_seqid;
        __be32  sl_status;
        u32     sl_datalen;
+       u16     sl_opcnt;
+#define NFSD4_SLOT_INUSE       (1 << 0)
+#define NFSD4_SLOT_CACHETHIS   (1 << 1)
+       u8      sl_flags;
        char    sl_data[];
 };
 
index 2364747ee97db68d9d14600c1e849127f4ab9a71..21dccdfcb7a6d053e43546c8e3b368b391ebc945 100644 (file)
@@ -503,7 +503,8 @@ static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp)
 
 static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp)
 {
-       return !resp->cstate.slot->sl_cachethis || nfsd4_is_solo_sequence(resp);
+       return !(resp->cstate.slot->sl_flags & NFSD4_SLOT_CACHETHIS)
+               || nfsd4_is_solo_sequence(resp);
 }
 
 #define NFS4_SVC_XDRSIZE               sizeof(struct nfsd4_compoundargs)