session: use target_highest_slotid to limit slot table

adds support for CB_RECALL_SLOT with function nfs41_session_recall_slot()

when SEQUENCE or CB_RECALL_SLOT gives us a valid target_highest_slotid, use it to update max_slots

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2012-05-09 13:48:35 -04:00 committed by Olga Kornievskaia
parent 1905abd027
commit a3146af76d
4 changed files with 49 additions and 6 deletions

View file

@ -54,9 +54,27 @@ static void init_slot_table(nfs41_slot_table *table)
LeaveCriticalSection(&table->lock);
}
static void resize_slot_table(
IN nfs41_slot_table *table,
IN uint32_t target_highest_slotid)
{
if (target_highest_slotid >= NFS41_MAX_NUM_SLOTS)
target_highest_slotid = NFS41_MAX_NUM_SLOTS - 1;
if (table->max_slots != target_highest_slotid + 1) {
dprintf(2, "updated max_slots %u to %u\n",
table->max_slots, target_highest_slotid + 1);
table->max_slots = target_highest_slotid + 1;
if (slot_table_avail(table))
WakeAllConditionVariable(&table->cond);
}
}
void nfs41_session_bump_seq(
IN nfs41_session *session,
IN uint32_t slotid)
IN uint32_t slotid,
IN uint32_t target_highest_slotid)
{
nfs41_slot_table *table = &session->table;
@ -66,6 +84,8 @@ void nfs41_session_bump_seq(
if (slotid < NFS41_MAX_NUM_SLOTS)
table->seq_nums[slotid]++;
resize_slot_table(table, target_highest_slotid);
LeaveCriticalSection(&table->lock);
ReleaseSRWLockShared(&session->client->session_lock);
}
@ -137,6 +157,21 @@ void nfs41_session_get_slot(
session, *slot, *seqid, *highest);
}
int nfs41_session_recall_slot(
IN nfs41_session *session,
IN OUT uint32_t target_highest_slotid)
{
nfs41_slot_table *table = &session->table;
AcquireSRWLockShared(&session->client->session_lock);
EnterCriticalSection(&table->lock);
resize_slot_table(table, target_highest_slotid);
LeaveCriticalSection(&table->lock);
ReleaseSRWLockShared(&session->client->session_lock);
return NFS4_OK;
}
void nfs41_session_sequence(
nfs41_sequence_args *args,
nfs41_session *session,