aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4state.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-01-17 22:04:25 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-01-31 19:28:06 -0500
commit7ba127ab9f5f83991df4142d5bc4fc319cd77a54 (patch)
treea627905cdb6a4be7aa3a8b09df258bc524383524 /fs/nfs/nfs4state.c
parent9d12b216aa87f68c96f6dd8eb5d2d0ccc9989b1c (diff)
NFSv4: Move contents of struct rpc_sequence into struct nfs_seqid_counter
Clean up. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r--fs/nfs/nfs4state.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 5abf23615bc5..cf7bc39aa0ee 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -384,6 +384,22 @@ nfs4_remove_state_owner_locked(struct nfs4_state_owner *sp)
384 ida_remove(&server->openowner_id, sp->so_owner_id); 384 ida_remove(&server->openowner_id, sp->so_owner_id);
385} 385}
386 386
387static void
388nfs4_init_seqid_counter(struct nfs_seqid_counter *sc)
389{
390 sc->flags = 0;
391 sc->counter = 0;
392 spin_lock_init(&sc->lock);
393 INIT_LIST_HEAD(&sc->list);
394 rpc_init_wait_queue(&sc->wait, "Seqid_waitqueue");
395}
396
397static void
398nfs4_destroy_seqid_counter(struct nfs_seqid_counter *sc)
399{
400 rpc_destroy_wait_queue(&sc->wait);
401}
402
387/* 403/*
388 * nfs4_alloc_state_owner(): this is called on the OPEN or CREATE path to 404 * nfs4_alloc_state_owner(): this is called on the OPEN or CREATE path to
389 * create a new state_owner. 405 * create a new state_owner.
@@ -403,10 +419,7 @@ nfs4_alloc_state_owner(struct nfs_server *server,
403 sp->so_cred = get_rpccred(cred); 419 sp->so_cred = get_rpccred(cred);
404 spin_lock_init(&sp->so_lock); 420 spin_lock_init(&sp->so_lock);
405 INIT_LIST_HEAD(&sp->so_states); 421 INIT_LIST_HEAD(&sp->so_states);
406 rpc_init_wait_queue(&sp->so_sequence.wait, "Seqid_waitqueue"); 422 nfs4_init_seqid_counter(&sp->so_seqid);
407 sp->so_seqid.sequence = &sp->so_sequence;
408 spin_lock_init(&sp->so_sequence.lock);
409 INIT_LIST_HEAD(&sp->so_sequence.list);
410 atomic_set(&sp->so_count, 1); 423 atomic_set(&sp->so_count, 1);
411 INIT_LIST_HEAD(&sp->so_lru); 424 INIT_LIST_HEAD(&sp->so_lru);
412 return sp; 425 return sp;
@@ -428,7 +441,7 @@ nfs4_drop_state_owner(struct nfs4_state_owner *sp)
428 441
429static void nfs4_free_state_owner(struct nfs4_state_owner *sp) 442static void nfs4_free_state_owner(struct nfs4_state_owner *sp)
430{ 443{
431 rpc_destroy_wait_queue(&sp->so_sequence.wait); 444 nfs4_destroy_seqid_counter(&sp->so_seqid);
432 put_rpccred(sp->so_cred); 445 put_rpccred(sp->so_cred);
433 kfree(sp); 446 kfree(sp);
434} 447}
@@ -748,10 +761,7 @@ static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, f
748 lsp = kzalloc(sizeof(*lsp), GFP_NOFS); 761 lsp = kzalloc(sizeof(*lsp), GFP_NOFS);
749 if (lsp == NULL) 762 if (lsp == NULL)
750 return NULL; 763 return NULL;
751 rpc_init_wait_queue(&lsp->ls_sequence.wait, "lock_seqid_waitqueue"); 764 nfs4_init_seqid_counter(&lsp->ls_seqid);
752 spin_lock_init(&lsp->ls_sequence.lock);
753 INIT_LIST_HEAD(&lsp->ls_sequence.list);
754 lsp->ls_seqid.sequence = &lsp->ls_sequence;
755 atomic_set(&lsp->ls_count, 1); 765 atomic_set(&lsp->ls_count, 1);
756 lsp->ls_state = state; 766 lsp->ls_state = state;
757 lsp->ls_owner.lo_type = type; 767 lsp->ls_owner.lo_type = type;
@@ -780,7 +790,7 @@ static void nfs4_free_lock_state(struct nfs4_lock_state *lsp)
780 struct nfs_server *server = lsp->ls_state->owner->so_server; 790 struct nfs_server *server = lsp->ls_state->owner->so_server;
781 791
782 ida_simple_remove(&server->lockowner_id, lsp->ls_id); 792 ida_simple_remove(&server->lockowner_id, lsp->ls_id);
783 rpc_destroy_wait_queue(&lsp->ls_sequence.wait); 793 nfs4_destroy_seqid_counter(&lsp->ls_seqid);
784 kfree(lsp); 794 kfree(lsp);
785} 795}
786 796
@@ -914,7 +924,7 @@ struct nfs_seqid *nfs_alloc_seqid(struct nfs_seqid_counter *counter, gfp_t gfp_m
914void nfs_release_seqid(struct nfs_seqid *seqid) 924void nfs_release_seqid(struct nfs_seqid *seqid)
915{ 925{
916 if (!list_empty(&seqid->list)) { 926 if (!list_empty(&seqid->list)) {
917 struct rpc_sequence *sequence = seqid->sequence->sequence; 927 struct nfs_seqid_counter *sequence = seqid->sequence;
918 928
919 spin_lock(&sequence->lock); 929 spin_lock(&sequence->lock);
920 list_del_init(&seqid->list); 930 list_del_init(&seqid->list);
@@ -936,7 +946,7 @@ void nfs_free_seqid(struct nfs_seqid *seqid)
936 */ 946 */
937static void nfs_increment_seqid(int status, struct nfs_seqid *seqid) 947static void nfs_increment_seqid(int status, struct nfs_seqid *seqid)
938{ 948{
939 BUG_ON(list_first_entry(&seqid->sequence->sequence->list, struct nfs_seqid, list) != seqid); 949 BUG_ON(list_first_entry(&seqid->sequence->list, struct nfs_seqid, list) != seqid);
940 switch (status) { 950 switch (status) {
941 case 0: 951 case 0:
942 break; 952 break;
@@ -987,7 +997,7 @@ void nfs_increment_lock_seqid(int status, struct nfs_seqid *seqid)
987 997
988int nfs_wait_on_sequence(struct nfs_seqid *seqid, struct rpc_task *task) 998int nfs_wait_on_sequence(struct nfs_seqid *seqid, struct rpc_task *task)
989{ 999{
990 struct rpc_sequence *sequence = seqid->sequence->sequence; 1000 struct nfs_seqid_counter *sequence = seqid->sequence;
991 int status = 0; 1001 int status = 0;
992 1002
993 spin_lock(&sequence->lock); 1003 spin_lock(&sequence->lock);