Skip to content

Commit

Permalink
NFSv4: Final tweak to sequence id
Browse files Browse the repository at this point in the history
 Sacrifice queueing fairness for performance.

 Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Oct 20, 2005
1 parent a0857d0 commit 4e51336
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion fs/nfs/nfs4_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ struct nfs_seqid_counter {
};

struct nfs_seqid {
struct list_head list;
struct nfs_seqid_counter *sequence;
struct list_head list;
};

static inline void nfs_confirm_seqid(struct nfs_seqid_counter *seqid, int status)
Expand Down
23 changes: 13 additions & 10 deletions fs/nfs/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,15 +670,12 @@ void nfs4_copy_stateid(nfs4_stateid *dst, struct nfs4_state *state, fl_owner_t f

struct nfs_seqid *nfs_alloc_seqid(struct nfs_seqid_counter *counter)
{
struct rpc_sequence *sequence = counter->sequence;
struct nfs_seqid *new;

new = kmalloc(sizeof(*new), GFP_KERNEL);
if (new != NULL) {
new->sequence = counter;
spin_lock(&sequence->lock);
list_add_tail(&new->list, &sequence->list);
spin_unlock(&sequence->lock);
INIT_LIST_HEAD(&new->list);
}
return new;
}
Expand All @@ -687,10 +684,12 @@ void nfs_free_seqid(struct nfs_seqid *seqid)
{
struct rpc_sequence *sequence = seqid->sequence->sequence;

spin_lock(&sequence->lock);
list_del(&seqid->list);
rpc_wake_up(&sequence->wait);
spin_unlock(&sequence->lock);
if (!list_empty(&seqid->list)) {
spin_lock(&sequence->lock);
list_del(&seqid->list);
spin_unlock(&sequence->lock);
}
rpc_wake_up_next(&sequence->wait);
kfree(seqid);
}

Expand Down Expand Up @@ -746,12 +745,16 @@ int nfs_wait_on_sequence(struct nfs_seqid *seqid, struct rpc_task *task)
struct rpc_sequence *sequence = seqid->sequence->sequence;
int status = 0;

if (sequence->list.next == &seqid->list)
goto out;
spin_lock(&sequence->lock);
if (sequence->list.next != &seqid->list) {
if (!list_empty(&sequence->list)) {
rpc_sleep_on(&sequence->wait, task, NULL, NULL);
status = -EAGAIN;
}
} else
list_add(&seqid->list, &sequence->list);
spin_unlock(&sequence->lock);
out:
return status;
}

Expand Down

0 comments on commit 4e51336

Please sign in to comment.