aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorRicardo Labiaga <Ricardo.Labiaga@netapp.com>2009-04-01 09:23:31 -0400
committerBenny Halevy <bhalevy@panasas.com>2009-06-17 17:11:41 -0400
commitb73dafa7ac94ca8387f65c57cb63a7ffac91bf2c (patch)
tree4df5b49dd611a0b585ff2216e219296e240a7506 /fs/nfs/nfs4proc.c
parent65fc64e547c794764a441e16e95bb76c0e256bd7 (diff)
nfs41: Backchannel: Refactor nfs4_reset_slot_table()
Generalize nfs4_reset_slot_table() so it can be used to reset the backchannel slot table in addition to the forechannel slot table. Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 5da939d577d5..a7b1d6c228cd 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4370,19 +4370,21 @@ int nfs4_proc_get_lease_time(struct nfs_client *clp, struct nfs_fsinfo *fsinfo)
4370 return status; 4370 return status;
4371} 4371}
4372 4372
4373/* Reset a slot table */ 4373/*
4374static int nfs4_reset_slot_table(struct nfs4_session *session) 4374 * Reset a slot table
4375 */
4376static int nfs4_reset_slot_table(struct nfs4_slot_table *tbl, int max_slots,
4377 int old_max_slots, int ivalue)
4375{ 4378{
4376 struct nfs4_slot_table *tbl = &session->fc_slot_table; 4379 int i;
4377 int i, max_slots = session->fc_attrs.max_reqs;
4378 int old_max_slots = session->fc_slot_table.max_slots;
4379 int ret = 0; 4380 int ret = 0;
4380 4381
4381 dprintk("--> %s: max_reqs=%u, tbl %p\n", __func__, 4382 dprintk("--> %s: max_reqs=%u, tbl %p\n", __func__, max_slots, tbl);
4382 session->fc_attrs.max_reqs, tbl);
4383 4383
4384 /* Until we have dynamic slot table adjustment, insist 4384 /*
4385 * upon the same slot table size */ 4385 * Until we have dynamic slot table adjustment, insist
4386 * upon the same slot table size
4387 */
4386 if (max_slots != old_max_slots) { 4388 if (max_slots != old_max_slots) {
4387 dprintk("%s reset slot table does't match old\n", 4389 dprintk("%s reset slot table does't match old\n",
4388 __func__); 4390 __func__);
@@ -4391,7 +4393,7 @@ static int nfs4_reset_slot_table(struct nfs4_session *session)
4391 } 4393 }
4392 spin_lock(&tbl->slot_tbl_lock); 4394 spin_lock(&tbl->slot_tbl_lock);
4393 for (i = 0; i < max_slots; ++i) 4395 for (i = 0; i < max_slots; ++i)
4394 tbl->slots[i].seq_nr = 1; 4396 tbl->slots[i].seq_nr = ivalue;
4395 tbl->highest_used_slotid = -1; 4397 tbl->highest_used_slotid = -1;
4396 spin_unlock(&tbl->slot_tbl_lock); 4398 spin_unlock(&tbl->slot_tbl_lock);
4397 dprintk("%s: tbl=%p slots=%p max_slots=%d\n", __func__, 4399 dprintk("%s: tbl=%p slots=%p max_slots=%d\n", __func__,
@@ -4402,6 +4404,20 @@ out:
4402} 4404}
4403 4405
4404/* 4406/*
4407 * Reset the forechannel and backchannel slot tables
4408 */
4409static int nfs4_reset_slot_tables(struct nfs4_session *session)
4410{
4411 int status;
4412
4413 status = nfs4_reset_slot_table(&session->fc_slot_table,
4414 session->fc_attrs.max_reqs,
4415 session->fc_slot_table.max_slots,
4416 1);
4417 return status;
4418}
4419
4420/*
4405 * Initialize slot table 4421 * Initialize slot table
4406 */ 4422 */
4407static int nfs4_init_slot_table(struct nfs4_session *session) 4423static int nfs4_init_slot_table(struct nfs4_session *session)
@@ -4639,7 +4655,7 @@ int nfs4_proc_create_session(struct nfs_client *clp, int reset)
4639 4655
4640 /* Init or reset the fore channel */ 4656 /* Init or reset the fore channel */
4641 if (reset) 4657 if (reset)
4642 status = nfs4_reset_slot_table(session); 4658 status = nfs4_reset_slot_tables(session);
4643 else 4659 else
4644 status = nfs4_init_slot_table(session); 4660 status = nfs4_init_slot_table(session);
4645 dprintk("fore channel slot table initialization returned %d\n", status); 4661 dprintk("fore channel slot table initialization returned %d\n", status);