aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2005-10-20 17:22:41 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2005-10-20 17:22:41 -0400
commit4e51336a00bdcb42960acca52c23e90e9f4e6959 (patch)
tree87d619bcd796a0c272abe2499bcc56bc3eda30b4 /fs/nfs
parenta0857d03b21fa54653c9d2fe7a315381176015b4 (diff)
NFSv4: Final tweak to sequence id
Sacrifice queueing fairness for performance. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs4_fs.h2
-rw-r--r--fs/nfs/nfs4state.c23
2 files changed, 14 insertions, 11 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 45bff1d1a513..5c0dd26d0985 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -110,8 +110,8 @@ struct nfs_seqid_counter {
110}; 110};
111 111
112struct nfs_seqid { 112struct nfs_seqid {
113 struct list_head list;
114 struct nfs_seqid_counter *sequence; 113 struct nfs_seqid_counter *sequence;
114 struct list_head list;
115}; 115};
116 116
117static inline void nfs_confirm_seqid(struct nfs_seqid_counter *seqid, int status) 117static inline void nfs_confirm_seqid(struct nfs_seqid_counter *seqid, int status)
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index da0861db57fb..c59ef90e956b 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -670,15 +670,12 @@ void nfs4_copy_stateid(nfs4_stateid *dst, struct nfs4_state *state, fl_owner_t f
670 670
671struct nfs_seqid *nfs_alloc_seqid(struct nfs_seqid_counter *counter) 671struct nfs_seqid *nfs_alloc_seqid(struct nfs_seqid_counter *counter)
672{ 672{
673 struct rpc_sequence *sequence = counter->sequence;
674 struct nfs_seqid *new; 673 struct nfs_seqid *new;
675 674
676 new = kmalloc(sizeof(*new), GFP_KERNEL); 675 new = kmalloc(sizeof(*new), GFP_KERNEL);
677 if (new != NULL) { 676 if (new != NULL) {
678 new->sequence = counter; 677 new->sequence = counter;
679 spin_lock(&sequence->lock); 678 INIT_LIST_HEAD(&new->list);
680 list_add_tail(&new->list, &sequence->list);
681 spin_unlock(&sequence->lock);
682 } 679 }
683 return new; 680 return new;
684} 681}
@@ -687,10 +684,12 @@ void nfs_free_seqid(struct nfs_seqid *seqid)
687{ 684{
688 struct rpc_sequence *sequence = seqid->sequence->sequence; 685 struct rpc_sequence *sequence = seqid->sequence->sequence;
689 686
690 spin_lock(&sequence->lock); 687 if (!list_empty(&seqid->list)) {
691 list_del(&seqid->list); 688 spin_lock(&sequence->lock);
692 rpc_wake_up(&sequence->wait); 689 list_del(&seqid->list);
693 spin_unlock(&sequence->lock); 690 spin_unlock(&sequence->lock);
691 }
692 rpc_wake_up_next(&sequence->wait);
694 kfree(seqid); 693 kfree(seqid);
695} 694}
696 695
@@ -746,12 +745,16 @@ int nfs_wait_on_sequence(struct nfs_seqid *seqid, struct rpc_task *task)
746 struct rpc_sequence *sequence = seqid->sequence->sequence; 745 struct rpc_sequence *sequence = seqid->sequence->sequence;
747 int status = 0; 746 int status = 0;
748 747
748 if (sequence->list.next == &seqid->list)
749 goto out;
749 spin_lock(&sequence->lock); 750 spin_lock(&sequence->lock);
750 if (sequence->list.next != &seqid->list) { 751 if (!list_empty(&sequence->list)) {
751 rpc_sleep_on(&sequence->wait, task, NULL, NULL); 752 rpc_sleep_on(&sequence->wait, task, NULL, NULL);
752 status = -EAGAIN; 753 status = -EAGAIN;
753 } 754 } else
755 list_add(&seqid->list, &sequence->list);
754 spin_unlock(&sequence->lock); 756 spin_unlock(&sequence->lock);
757out:
755 return status; 758 return status;
756} 759}
757 760