diff options
author | Ricardo Labiaga <Ricardo.Labiaga@netapp.com> | 2009-04-01 09:23:33 -0400 |
---|---|---|
committer | Benny Halevy <bhalevy@panasas.com> | 2009-06-17 17:11:42 -0400 |
commit | f8625a6a4bb76207302be58453603d8e324df490 (patch) | |
tree | 27be80250213e65592fd1812a4467c1c0af09138 /fs/nfs/nfs4proc.c | |
parent | 050047ce71bcf60867d2af7a9dc965a9c6f15cb8 (diff) |
nfs41: Backchannel: Add a backchannel slot table to the session
Defines a new 'struct nfs4_slot_table' in the 'struct nfs4_session'
for use by the backchannel. Initializes, resets, and destroys the backchannel
slot table in the same manner the forechannel slot table is initialized,
reset, and destroyed.
The sequenceid for each slot in the backchannel slot table is initialized
to 0, whereas the forechannel slotid's sequenceid is set to 1.
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.c | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index c3019ad85893..57dabb8a048e 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -4414,9 +4414,30 @@ static int nfs4_reset_slot_tables(struct nfs4_session *session) | |||
4414 | session->fc_attrs.max_reqs, | 4414 | session->fc_attrs.max_reqs, |
4415 | session->fc_slot_table.max_slots, | 4415 | session->fc_slot_table.max_slots, |
4416 | 1); | 4416 | 1); |
4417 | if (status) | ||
4418 | return status; | ||
4419 | |||
4420 | status = nfs4_reset_slot_table(&session->bc_slot_table, | ||
4421 | session->bc_attrs.max_reqs, | ||
4422 | session->bc_slot_table.max_slots, | ||
4423 | 0); | ||
4417 | return status; | 4424 | return status; |
4418 | } | 4425 | } |
4419 | 4426 | ||
4427 | /* Destroy the slot table */ | ||
4428 | static void nfs4_destroy_slot_tables(struct nfs4_session *session) | ||
4429 | { | ||
4430 | if (session->fc_slot_table.slots != NULL) { | ||
4431 | kfree(session->fc_slot_table.slots); | ||
4432 | session->fc_slot_table.slots = NULL; | ||
4433 | } | ||
4434 | if (session->bc_slot_table.slots != NULL) { | ||
4435 | kfree(session->bc_slot_table.slots); | ||
4436 | session->bc_slot_table.slots = NULL; | ||
4437 | } | ||
4438 | return; | ||
4439 | } | ||
4440 | |||
4420 | /* | 4441 | /* |
4421 | * Initialize slot table | 4442 | * Initialize slot table |
4422 | */ | 4443 | */ |
@@ -4470,17 +4491,15 @@ static int nfs4_init_slot_tables(struct nfs4_session *session) | |||
4470 | 4491 | ||
4471 | status = nfs4_init_slot_table(&session->fc_slot_table, | 4492 | status = nfs4_init_slot_table(&session->fc_slot_table, |
4472 | session->fc_attrs.max_reqs, 1); | 4493 | session->fc_attrs.max_reqs, 1); |
4473 | return status; | 4494 | if (status) |
4474 | } | 4495 | return status; |
4475 | 4496 | ||
4476 | /* Destroy the slot table */ | 4497 | status = nfs4_init_slot_table(&session->bc_slot_table, |
4477 | static void nfs4_destroy_slot_table(struct nfs4_session *session) | 4498 | session->bc_attrs.max_reqs, 0); |
4478 | { | 4499 | if (status) |
4479 | if (session->fc_slot_table.slots == NULL) | 4500 | nfs4_destroy_slot_tables(session); |
4480 | return; | 4501 | |
4481 | kfree(session->fc_slot_table.slots); | 4502 | return status; |
4482 | session->fc_slot_table.slots = NULL; | ||
4483 | return; | ||
4484 | } | 4503 | } |
4485 | 4504 | ||
4486 | struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp) | 4505 | struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp) |
@@ -4503,7 +4522,12 @@ struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp) | |||
4503 | 4522 | ||
4504 | tbl = &session->fc_slot_table; | 4523 | tbl = &session->fc_slot_table; |
4505 | spin_lock_init(&tbl->slot_tbl_lock); | 4524 | spin_lock_init(&tbl->slot_tbl_lock); |
4506 | rpc_init_wait_queue(&tbl->slot_tbl_waitq, "Slot table"); | 4525 | rpc_init_wait_queue(&tbl->slot_tbl_waitq, "ForeChannel Slot table"); |
4526 | |||
4527 | tbl = &session->bc_slot_table; | ||
4528 | spin_lock_init(&tbl->slot_tbl_lock); | ||
4529 | rpc_init_wait_queue(&tbl->slot_tbl_waitq, "BackChannel Slot table"); | ||
4530 | |||
4507 | session->clp = clp; | 4531 | session->clp = clp; |
4508 | return session; | 4532 | return session; |
4509 | } | 4533 | } |
@@ -4515,7 +4539,7 @@ void nfs4_destroy_session(struct nfs4_session *session) | |||
4515 | __func__, session->clp->cl_rpcclient->cl_xprt); | 4539 | __func__, session->clp->cl_rpcclient->cl_xprt); |
4516 | xprt_destroy_backchannel(session->clp->cl_rpcclient->cl_xprt, | 4540 | xprt_destroy_backchannel(session->clp->cl_rpcclient->cl_xprt, |
4517 | NFS41_BC_MIN_CALLBACKS); | 4541 | NFS41_BC_MIN_CALLBACKS); |
4518 | nfs4_destroy_slot_table(session); | 4542 | nfs4_destroy_slot_tables(session); |
4519 | kfree(session); | 4543 | kfree(session); |
4520 | } | 4544 | } |
4521 | 4545 | ||