Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177177
b: refs/heads/master
c: efe0cb6
h: refs/heads/master
i:
  177175: e4d5f4f
v: v3
  • Loading branch information
J. Bruce Fields committed Oct 27, 2009
1 parent 2f28d0f commit d0813d6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dd829c45640ff14d7a039af40b3b3975f1b2e484
refs/heads/master: efe0cb6d5a1f20ad4df045a055048afed4c5e660
14 changes: 11 additions & 3 deletions trunk/fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,15 @@ free_session_slots(struct nfsd4_session *ses)
kfree(ses->se_slots[i]);
}

/*
* We don't actually need to cache the rpc and session headers, so we
* can allocate a little less for each slot:
*/
static inline int slot_bytes(struct nfsd4_channel_attrs *ca)
{
return ca->maxresp_cached - NFSD_MIN_HDR_SEQ_SZ;
}

static int
alloc_init_session(struct svc_rqst *rqstp, struct nfs4_client *clp,
struct nfsd4_create_session *cses)
Expand Down Expand Up @@ -555,7 +564,7 @@ alloc_init_session(struct svc_rqst *rqstp, struct nfs4_client *clp,
memcpy(new, &tmp, sizeof(*new));

/* allocate each struct nfsd4_slot and data cache in one piece */
cachesize = new->se_fchannel.maxresp_cached - NFSD_MIN_HDR_SEQ_SZ;
cachesize = slot_bytes(&new->se_fchannel);
for (i = 0; i < new->se_fchannel.maxreqs; i++) {
sp = kzalloc(sizeof(*sp) + cachesize, GFP_KERNEL);
if (!sp)
Expand Down Expand Up @@ -633,8 +642,7 @@ free_session(struct kref *kref)

ses = container_of(kref, struct nfsd4_session, se_ref);
spin_lock(&nfsd_drc_lock);
mem = ses->se_fchannel.maxreqs
* (ses->se_fchannel.maxresp_cached - NFSD_MIN_HDR_SEQ_SZ);
mem = ses->se_fchannel.maxreqs * slot_bytes(&ses->se_fchannel);
nfsd_drc_mem_used -= mem;
spin_unlock(&nfsd_drc_lock);
free_session_slots(ses);
Expand Down

0 comments on commit d0813d6

Please sign in to comment.