diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-11-20 14:17:32 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-11-26 17:49:53 -0500 |
commit | f4af6e2abc8efb1695203a2b76876edf80f79960 (patch) | |
tree | 0b3c50e8b3a850bd5886f51c98fc9e1c1d69e2ea /fs | |
parent | 2dc03b7f00d7fcd7dbb9302c5ebbd0c2b7fa3557 (diff) |
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.c | 12 |
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 | |||
412 | * Must be called while holding tbl->slot_tbl_lock | 412 | * Must be called while holding tbl->slot_tbl_lock |
413 | */ | 413 | */ |
414 | static void | 414 | static void |
415 | nfs4_free_slot(struct nfs4_slot_table *tbl, u32 slotid) | 415 | nfs4_free_slot(struct nfs4_slot_table *tbl, struct nfs4_slot *slot) |
416 | { | 416 | { |
417 | u32 slotid = slot->slot_nr; | ||
418 | |||
417 | /* clear used bit in bitmap */ | 419 | /* clear used bit in bitmap */ |
418 | __clear_bit(slotid, tbl->used_slots); | 420 | __clear_bit(slotid, tbl->used_slots); |
419 | 421 | ||
420 | /* update highest_used_slotid when it is freed */ | 422 | /* update highest_used_slotid when it is freed */ |
421 | if (slotid == tbl->highest_used_slotid) { | 423 | if (slotid == tbl->highest_used_slotid) { |
422 | slotid = find_last_bit(tbl->used_slots, tbl->max_slots); | 424 | u32 new_max = find_last_bit(tbl->used_slots, slotid); |
423 | if (slotid < tbl->max_slots) | 425 | if (new_max < slotid) |
424 | tbl->highest_used_slotid = slotid; | 426 | tbl->highest_used_slotid = new_max; |
425 | else | 427 | else |
426 | tbl->highest_used_slotid = NFS4_NO_SLOT; | 428 | tbl->highest_used_slotid = NFS4_NO_SLOT; |
427 | } | 429 | } |
@@ -480,7 +482,7 @@ static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res) | |||
480 | session = tbl->session; | 482 | session = tbl->session; |
481 | 483 | ||
482 | spin_lock(&tbl->slot_tbl_lock); | 484 | spin_lock(&tbl->slot_tbl_lock); |
483 | nfs4_free_slot(tbl, res->sr_slot - tbl->slots); | 485 | nfs4_free_slot(tbl, res->sr_slot); |
484 | nfs4_check_drain_fc_complete(session); | 486 | nfs4_check_drain_fc_complete(session); |
485 | spin_unlock(&tbl->slot_tbl_lock); | 487 | spin_unlock(&tbl->slot_tbl_lock); |
486 | res->sr_slot = NULL; | 488 | res->sr_slot = NULL; |