summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust2012-11-20 20:17:32 +0100
committerTrond Myklebust2012-11-26 23:49:53 +0100
commitf4af6e2abc8efb1695203a2b76876edf80f79960 (patch)
tree0b3c50e8b3a850bd5886f51c98fc9e1c1d69e2ea /fs
parentNFSv4.1: Simplify slot allocation (diff)
downloadkernel-qcow2-linux-f4af6e2abc8efb1695203a2b76876edf80f79960.tar.gz
kernel-qcow2-linux-f4af6e2abc8efb1695203a2b76876edf80f79960.tar.xz
kernel-qcow2-linux-f4af6e2abc8efb1695203a2b76876edf80f79960.zip
NFSv4.1: Clean up nfs4_free_slot
Change the argument to take the pointer to the slot, instead of just the slotid. We know that the new value of highest_used_slot must be less than the current value. No need to scan the whole table. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4proc.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 0789ef18a94d..197ef3e4e1f7 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -412,16 +412,18 @@ static void renew_lease(const struct nfs_server *server, unsigned long timestamp
* Must be called while holding tbl->slot_tbl_lock
*/
static void
-nfs4_free_slot(struct nfs4_slot_table *tbl, u32 slotid)
+nfs4_free_slot(struct nfs4_slot_table *tbl, struct nfs4_slot *slot)
{
+ u32 slotid = slot->slot_nr;
+
/* clear used bit in bitmap */
__clear_bit(slotid, tbl->used_slots);
/* update highest_used_slotid when it is freed */
if (slotid == tbl->highest_used_slotid) {
- slotid = find_last_bit(tbl->used_slots, tbl->max_slots);
- if (slotid < tbl->max_slots)
- tbl->highest_used_slotid = slotid;
+ u32 new_max = find_last_bit(tbl->used_slots, slotid);
+ if (new_max < slotid)
+ tbl->highest_used_slotid = new_max;
else
tbl->highest_used_slotid = NFS4_NO_SLOT;
}
@@ -480,7 +482,7 @@ static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res)
session = tbl->session;
spin_lock(&tbl->slot_tbl_lock);
- nfs4_free_slot(tbl, res->sr_slot - tbl->slots);
+ nfs4_free_slot(tbl, res->sr_slot);
nfs4_check_drain_fc_complete(session);
spin_unlock(&tbl->slot_tbl_lock);
res->sr_slot = NULL;