aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-11-16 12:25:01 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-11-26 17:49:04 -0500
commite3725ec015dfbbeb896295cf2b3a995f28b0630e (patch)
tree1ec889fb5b29d2fa2da4912107d5c3dd41baba7f /fs/nfs/nfs4proc.c
parent933602e368c4452260c9bff4fbb3baba35cf987a (diff)
NFSv4.1: Shrink struct nfs4_sequence_res by moving the session pointer
Move the session pointer into the slot table, then have struct nfs4_slot point to that slot table. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 14b39742b6e4..5b61c4a83191 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -467,25 +467,28 @@ void nfs4_check_drain_bc_complete(struct nfs4_session *ses)
467 467
468static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res) 468static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res)
469{ 469{
470 struct nfs4_session *session;
470 struct nfs4_slot_table *tbl; 471 struct nfs4_slot_table *tbl;
471 472
472 tbl = &res->sr_session->fc_slot_table;
473 if (!res->sr_slot) { 473 if (!res->sr_slot) {
474 /* just wake up the next guy waiting since 474 /* just wake up the next guy waiting since
475 * we may have not consumed a slot after all */ 475 * we may have not consumed a slot after all */
476 dprintk("%s: No slot\n", __func__); 476 dprintk("%s: No slot\n", __func__);
477 return; 477 return;
478 } 478 }
479 tbl = res->sr_slot->table;
480 session = tbl->session;
479 481
480 spin_lock(&tbl->slot_tbl_lock); 482 spin_lock(&tbl->slot_tbl_lock);
481 nfs4_free_slot(tbl, res->sr_slot - tbl->slots); 483 nfs4_free_slot(tbl, res->sr_slot - tbl->slots);
482 nfs4_check_drain_fc_complete(res->sr_session); 484 nfs4_check_drain_fc_complete(session);
483 spin_unlock(&tbl->slot_tbl_lock); 485 spin_unlock(&tbl->slot_tbl_lock);
484 res->sr_slot = NULL; 486 res->sr_slot = NULL;
485} 487}
486 488
487static int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res) 489static int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res)
488{ 490{
491 struct nfs4_session *session;
489 struct nfs4_slot *slot; 492 struct nfs4_slot *slot;
490 unsigned long timestamp; 493 unsigned long timestamp;
491 struct nfs_client *clp; 494 struct nfs_client *clp;
@@ -504,6 +507,7 @@ static int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *
504 goto out; 507 goto out;
505 508
506 slot = res->sr_slot; 509 slot = res->sr_slot;
510 session = slot->table->session;
507 511
508 /* Check the SEQUENCE operation status */ 512 /* Check the SEQUENCE operation status */
509 switch (res->sr_status) { 513 switch (res->sr_status) {
@@ -511,7 +515,7 @@ static int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *
511 /* Update the slot's sequence and clientid lease timer */ 515 /* Update the slot's sequence and clientid lease timer */
512 ++slot->seq_nr; 516 ++slot->seq_nr;
513 timestamp = slot->renewal_time; 517 timestamp = slot->renewal_time;
514 clp = res->sr_session->clp; 518 clp = session->clp;
515 do_renew_lease(clp, timestamp); 519 do_renew_lease(clp, timestamp);
516 /* Check sequence flags */ 520 /* Check sequence flags */
517 if (res->sr_status_flags != 0) 521 if (res->sr_status_flags != 0)
@@ -524,7 +528,7 @@ static int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *
524 */ 528 */
525 dprintk("%s: slot=%td seq=%d: Operation in progress\n", 529 dprintk("%s: slot=%td seq=%d: Operation in progress\n",
526 __func__, 530 __func__,
527 slot - res->sr_session->fc_slot_table.slots, 531 slot - session->fc_slot_table.slots,
528 slot->seq_nr); 532 slot->seq_nr);
529 goto out_retry; 533 goto out_retry;
530 default: 534 default:
@@ -546,7 +550,7 @@ out_retry:
546static int nfs4_sequence_done(struct rpc_task *task, 550static int nfs4_sequence_done(struct rpc_task *task,
547 struct nfs4_sequence_res *res) 551 struct nfs4_sequence_res *res)
548{ 552{
549 if (res->sr_session == NULL) 553 if (res->sr_slot == NULL)
550 return 1; 554 return 1;
551 return nfs41_sequence_done(task, res); 555 return nfs41_sequence_done(task, res);
552} 556}
@@ -591,7 +595,6 @@ static void nfs41_init_sequence(struct nfs4_sequence_args *args,
591 args->sa_cache_this = 0; 595 args->sa_cache_this = 0;
592 if (cache_reply) 596 if (cache_reply)
593 args->sa_cache_this = 1; 597 args->sa_cache_this = 1;
594 res->sr_session = NULL;
595 res->sr_slot = NULL; 598 res->sr_slot = NULL;
596} 599}
597 600
@@ -646,7 +649,6 @@ int nfs41_setup_sequence(struct nfs4_session *session,
646 649
647 dprintk("<-- %s slotid=%d seqid=%d\n", __func__, slotid, slot->seq_nr); 650 dprintk("<-- %s slotid=%d seqid=%d\n", __func__, slotid, slot->seq_nr);
648 651
649 res->sr_session = session;
650 res->sr_slot = slot; 652 res->sr_slot = slot;
651 res->sr_status_flags = 0; 653 res->sr_status_flags = 0;
652 /* 654 /*
@@ -5659,9 +5661,18 @@ int nfs4_proc_get_lease_time(struct nfs_client *clp, struct nfs_fsinfo *fsinfo)
5659 return status; 5661 return status;
5660} 5662}
5661 5663
5662struct nfs4_slot *nfs4_alloc_slots(u32 max_slots, gfp_t gfp_flags) 5664struct nfs4_slot *nfs4_alloc_slots(struct nfs4_slot_table *table,
5665 u32 max_slots, gfp_t gfp_flags)
5663{ 5666{
5664 return kmalloc_array(max_slots, sizeof(struct nfs4_slot), gfp_flags); 5667 struct nfs4_slot *tbl;
5668 u32 i;
5669
5670 tbl = kmalloc_array(max_slots, sizeof(*tbl), gfp_flags);
5671 if (tbl != NULL) {
5672 for (i = 0; i < max_slots; i++)
5673 tbl[i].table = table;
5674 }
5675 return tbl;
5665} 5676}
5666 5677
5667static void nfs4_add_and_init_slots(struct nfs4_slot_table *tbl, 5678static void nfs4_add_and_init_slots(struct nfs4_slot_table *tbl,
@@ -5699,7 +5710,7 @@ static int nfs4_realloc_slot_table(struct nfs4_slot_table *tbl, u32 max_reqs,
5699 5710
5700 /* Does the newly negotiated max_reqs match the existing slot table? */ 5711 /* Does the newly negotiated max_reqs match the existing slot table? */
5701 if (max_reqs != tbl->max_slots) { 5712 if (max_reqs != tbl->max_slots) {
5702 new = nfs4_alloc_slots(max_reqs, GFP_NOFS); 5713 new = nfs4_alloc_slots(tbl, max_reqs, GFP_NOFS);
5703 if (!new) 5714 if (!new)
5704 goto out; 5715 goto out;
5705 } 5716 }
@@ -5738,11 +5749,13 @@ static int nfs4_setup_session_slot_tables(struct nfs4_session *ses)
5738 dprintk("--> %s\n", __func__); 5749 dprintk("--> %s\n", __func__);
5739 /* Fore channel */ 5750 /* Fore channel */
5740 tbl = &ses->fc_slot_table; 5751 tbl = &ses->fc_slot_table;
5752 tbl->session = ses;
5741 status = nfs4_realloc_slot_table(tbl, ses->fc_attrs.max_reqs, 1); 5753 status = nfs4_realloc_slot_table(tbl, ses->fc_attrs.max_reqs, 1);
5742 if (status) /* -ENOMEM */ 5754 if (status) /* -ENOMEM */
5743 return status; 5755 return status;
5744 /* Back channel */ 5756 /* Back channel */
5745 tbl = &ses->bc_slot_table; 5757 tbl = &ses->bc_slot_table;
5758 tbl->session = ses;
5746 status = nfs4_realloc_slot_table(tbl, ses->bc_attrs.max_reqs, 0); 5759 status = nfs4_realloc_slot_table(tbl, ses->bc_attrs.max_reqs, 0);
5747 if (status && tbl->slots == NULL) 5760 if (status && tbl->slots == NULL)
5748 /* Fore and back channel share a connection so get 5761 /* Fore and back channel share a connection so get