aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-02-06 19:38:51 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-02-15 00:19:43 -0500
commit45d43c291e9a922d7b432b0dbcb1d8fb70d8410f (patch)
treeb7aeca1a66177b2b03c2bb96996d3d40cbbf7a9a /fs/nfs/nfs4proc.c
parent17347d03c008e2f504c33bb4905cdad0abc01319 (diff)
NFSv4.1: Convert slotid from u8 to u32
It is perfectly legal to negotiate up to 2^32-1 slots in the protocol, and with 10GigE, we are already seeing that 255 slots is far too limiting. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 482ed97189c9..f3f56f4a3b72 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -360,16 +360,14 @@ static void renew_lease(const struct nfs_server *server, unsigned long timestamp
360 * When updating highest_used_slotid there may be "holes" in the bitmap 360 * When updating highest_used_slotid there may be "holes" in the bitmap
361 * so we need to scan down from highest_used_slotid to 0 looking for the now 361 * so we need to scan down from highest_used_slotid to 0 looking for the now
362 * highest slotid in use. 362 * highest slotid in use.
363 * If none found, highest_used_slotid is set to -1. 363 * If none found, highest_used_slotid is set to NFS4_NO_SLOT.
364 * 364 *
365 * Must be called while holding tbl->slot_tbl_lock 365 * Must be called while holding tbl->slot_tbl_lock
366 */ 366 */
367static void 367static void
368nfs4_free_slot(struct nfs4_slot_table *tbl, u8 free_slotid) 368nfs4_free_slot(struct nfs4_slot_table *tbl, u32 slotid)
369{ 369{
370 int slotid = free_slotid; 370 BUG_ON(slotid >= NFS4_MAX_SLOT_TABLE);
371
372 BUG_ON(slotid < 0 || slotid >= NFS4_MAX_SLOT_TABLE);
373 /* clear used bit in bitmap */ 371 /* clear used bit in bitmap */
374 __clear_bit(slotid, tbl->used_slots); 372 __clear_bit(slotid, tbl->used_slots);
375 373
@@ -379,10 +377,10 @@ nfs4_free_slot(struct nfs4_slot_table *tbl, u8 free_slotid)
379 if (slotid < tbl->max_slots) 377 if (slotid < tbl->max_slots)
380 tbl->highest_used_slotid = slotid; 378 tbl->highest_used_slotid = slotid;
381 else 379 else
382 tbl->highest_used_slotid = -1; 380 tbl->highest_used_slotid = NFS4_NO_SLOT;
383 } 381 }
384 dprintk("%s: free_slotid %u highest_used_slotid %d\n", __func__, 382 dprintk("%s: slotid %u highest_used_slotid %d\n", __func__,
385 free_slotid, tbl->highest_used_slotid); 383 slotid, tbl->highest_used_slotid);
386} 384}
387 385
388bool nfs4_set_task_privileged(struct rpc_task *task, void *dummy) 386bool nfs4_set_task_privileged(struct rpc_task *task, void *dummy)
@@ -402,7 +400,7 @@ static void nfs4_check_drain_fc_complete(struct nfs4_session *ses)
402 return; 400 return;
403 } 401 }
404 402
405 if (ses->fc_slot_table.highest_used_slotid != -1) 403 if (ses->fc_slot_table.highest_used_slotid != NFS4_NO_SLOT)
406 return; 404 return;
407 405
408 dprintk("%s COMPLETE: Session Fore Channel Drained\n", __func__); 406 dprintk("%s COMPLETE: Session Fore Channel Drained\n", __func__);
@@ -415,7 +413,7 @@ static void nfs4_check_drain_fc_complete(struct nfs4_session *ses)
415void nfs4_check_drain_bc_complete(struct nfs4_session *ses) 413void nfs4_check_drain_bc_complete(struct nfs4_session *ses)
416{ 414{
417 if (!test_bit(NFS4_SESSION_DRAINING, &ses->session_state) || 415 if (!test_bit(NFS4_SESSION_DRAINING, &ses->session_state) ||
418 ses->bc_slot_table.highest_used_slotid != -1) 416 ses->bc_slot_table.highest_used_slotid != NFS4_NO_SLOT)
419 return; 417 return;
420 dprintk("%s COMPLETE: Session Back Channel Drained\n", __func__); 418 dprintk("%s COMPLETE: Session Back Channel Drained\n", __func__);
421 complete(&ses->bc_slot_table.complete); 419 complete(&ses->bc_slot_table.complete);
@@ -510,25 +508,25 @@ static int nfs4_sequence_done(struct rpc_task *task,
510 * nfs4_find_slot looks for an unset bit in the used_slots bitmap. 508 * nfs4_find_slot looks for an unset bit in the used_slots bitmap.
511 * If found, we mark the slot as used, update the highest_used_slotid, 509 * If found, we mark the slot as used, update the highest_used_slotid,
512 * and respectively set up the sequence operation args. 510 * and respectively set up the sequence operation args.
513 * The slot number is returned if found, or NFS4_MAX_SLOT_TABLE otherwise. 511 * The slot number is returned if found, or NFS4_NO_SLOT otherwise.
514 * 512 *
515 * Note: must be called with under the slot_tbl_lock. 513 * Note: must be called with under the slot_tbl_lock.
516 */ 514 */
517static u8 515static u32
518nfs4_find_slot(struct nfs4_slot_table *tbl) 516nfs4_find_slot(struct nfs4_slot_table *tbl)
519{ 517{
520 int slotid; 518 u32 slotid;
521 u8 ret_id = NFS4_MAX_SLOT_TABLE; 519 u32 ret_id = NFS4_NO_SLOT;
522 BUILD_BUG_ON((u8)NFS4_MAX_SLOT_TABLE != (int)NFS4_MAX_SLOT_TABLE);
523 520
524 dprintk("--> %s used_slots=%04lx highest_used=%d max_slots=%d\n", 521 dprintk("--> %s used_slots=%04lx highest_used=%u max_slots=%u\n",
525 __func__, tbl->used_slots[0], tbl->highest_used_slotid, 522 __func__, tbl->used_slots[0], tbl->highest_used_slotid,
526 tbl->max_slots); 523 tbl->max_slots);
527 slotid = find_first_zero_bit(tbl->used_slots, tbl->max_slots); 524 slotid = find_first_zero_bit(tbl->used_slots, tbl->max_slots);
528 if (slotid >= tbl->max_slots) 525 if (slotid >= tbl->max_slots)
529 goto out; 526 goto out;
530 __set_bit(slotid, tbl->used_slots); 527 __set_bit(slotid, tbl->used_slots);
531 if (slotid > tbl->highest_used_slotid) 528 if (slotid > tbl->highest_used_slotid ||
529 tbl->highest_used_slotid == NFS4_NO_SLOT)
532 tbl->highest_used_slotid = slotid; 530 tbl->highest_used_slotid = slotid;
533 ret_id = slotid; 531 ret_id = slotid;
534out: 532out:
@@ -555,7 +553,7 @@ int nfs41_setup_sequence(struct nfs4_session *session,
555{ 553{
556 struct nfs4_slot *slot; 554 struct nfs4_slot *slot;
557 struct nfs4_slot_table *tbl; 555 struct nfs4_slot_table *tbl;
558 u8 slotid; 556 u32 slotid;
559 557
560 dprintk("--> %s\n", __func__); 558 dprintk("--> %s\n", __func__);
561 /* slot already allocated? */ 559 /* slot already allocated? */
@@ -583,7 +581,7 @@ int nfs41_setup_sequence(struct nfs4_session *session,
583 } 581 }
584 582
585 slotid = nfs4_find_slot(tbl); 583 slotid = nfs4_find_slot(tbl);
586 if (slotid == NFS4_MAX_SLOT_TABLE) { 584 if (slotid == NFS4_NO_SLOT) {
587 rpc_sleep_on(&tbl->slot_tbl_waitq, task, NULL); 585 rpc_sleep_on(&tbl->slot_tbl_waitq, task, NULL);
588 spin_unlock(&tbl->slot_tbl_lock); 586 spin_unlock(&tbl->slot_tbl_lock);
589 dprintk("<-- %s: no free slots\n", __func__); 587 dprintk("<-- %s: no free slots\n", __func__);
@@ -5144,7 +5142,7 @@ static int nfs4_init_slot_table(struct nfs4_slot_table *tbl,
5144 spin_lock(&tbl->slot_tbl_lock); 5142 spin_lock(&tbl->slot_tbl_lock);
5145 tbl->max_slots = max_slots; 5143 tbl->max_slots = max_slots;
5146 tbl->slots = slot; 5144 tbl->slots = slot;
5147 tbl->highest_used_slotid = -1; /* no slot is currently used */ 5145 tbl->highest_used_slotid = NFS4_NO_SLOT; /* no slot is currently used */
5148 spin_unlock(&tbl->slot_tbl_lock); 5146 spin_unlock(&tbl->slot_tbl_lock);
5149 dprintk("%s: tbl=%p slots=%p max_slots=%d\n", __func__, 5147 dprintk("%s: tbl=%p slots=%p max_slots=%d\n", __func__,
5150 tbl, tbl->slots, tbl->max_slots); 5148 tbl, tbl->slots, tbl->max_slots);
@@ -5196,13 +5194,13 @@ struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp)
5196 return NULL; 5194 return NULL;
5197 5195
5198 tbl = &session->fc_slot_table; 5196 tbl = &session->fc_slot_table;
5199 tbl->highest_used_slotid = -1; 5197 tbl->highest_used_slotid = NFS4_NO_SLOT;
5200 spin_lock_init(&tbl->slot_tbl_lock); 5198 spin_lock_init(&tbl->slot_tbl_lock);
5201 rpc_init_priority_wait_queue(&tbl->slot_tbl_waitq, "ForeChannel Slot table"); 5199 rpc_init_priority_wait_queue(&tbl->slot_tbl_waitq, "ForeChannel Slot table");
5202 init_completion(&tbl->complete); 5200 init_completion(&tbl->complete);
5203 5201
5204 tbl = &session->bc_slot_table; 5202 tbl = &session->bc_slot_table;
5205 tbl->highest_used_slotid = -1; 5203 tbl->highest_used_slotid = NFS4_NO_SLOT;
5206 spin_lock_init(&tbl->slot_tbl_lock); 5204 spin_lock_init(&tbl->slot_tbl_lock);
5207 rpc_init_wait_queue(&tbl->slot_tbl_waitq, "BackChannel Slot table"); 5205 rpc_init_wait_queue(&tbl->slot_tbl_waitq, "BackChannel Slot table");
5208 init_completion(&tbl->complete); 5206 init_completion(&tbl->complete);