Commit 48c22eb2 authored by Trond Myklebust's avatar Trond Myklebust

NFS: Move struct nfs_unique_id into struct nfs_seqid_counter

Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 7ba127ab
...@@ -53,8 +53,14 @@ struct nfs4_minor_version_ops { ...@@ -53,8 +53,14 @@ struct nfs4_minor_version_ops {
const struct nfs4_state_maintenance_ops *state_renewal_ops; const struct nfs4_state_maintenance_ops *state_renewal_ops;
}; };
struct nfs_unique_id {
struct rb_node rb_node;
__u64 id;
};
#define NFS_SEQID_CONFIRMED 1 #define NFS_SEQID_CONFIRMED 1
struct nfs_seqid_counter { struct nfs_seqid_counter {
int owner_id;
int flags; int flags;
u32 counter; u32 counter;
spinlock_t lock; /* Protects the list */ spinlock_t lock; /* Protects the list */
...@@ -91,7 +97,6 @@ struct nfs4_state_owner { ...@@ -91,7 +97,6 @@ struct nfs4_state_owner {
unsigned long so_flags; unsigned long so_flags;
struct list_head so_states; struct list_head so_states;
struct nfs_seqid_counter so_seqid; struct nfs_seqid_counter so_seqid;
int so_owner_id;
}; };
enum { enum {
...@@ -131,7 +136,6 @@ struct nfs4_lock_state { ...@@ -131,7 +136,6 @@ struct nfs4_lock_state {
struct nfs4_state * ls_state; /* Pointer to open state */ struct nfs4_state * ls_state; /* Pointer to open state */
#define NFS_LOCK_INITIALIZED 1 #define NFS_LOCK_INITIALIZED 1
int ls_flags; int ls_flags;
int ls_id;
struct nfs_seqid_counter ls_seqid; struct nfs_seqid_counter ls_seqid;
nfs4_stateid ls_stateid; nfs4_stateid ls_stateid;
atomic_t ls_count; atomic_t ls_count;
......
...@@ -822,7 +822,7 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, ...@@ -822,7 +822,7 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry,
p->o_arg.open_flags = flags; p->o_arg.open_flags = flags;
p->o_arg.fmode = fmode & (FMODE_READ|FMODE_WRITE); p->o_arg.fmode = fmode & (FMODE_READ|FMODE_WRITE);
p->o_arg.clientid = server->nfs_client->cl_clientid; p->o_arg.clientid = server->nfs_client->cl_clientid;
p->o_arg.id = sp->so_owner_id; p->o_arg.id = sp->so_seqid.owner_id;
p->o_arg.name = &dentry->d_name; p->o_arg.name = &dentry->d_name;
p->o_arg.server = server; p->o_arg.server = server;
p->o_arg.bitmask = server->attr_bitmask; p->o_arg.bitmask = server->attr_bitmask;
...@@ -1447,7 +1447,7 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata) ...@@ -1447,7 +1447,7 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata)
rcu_read_unlock(); rcu_read_unlock();
} }
/* Update sequence id. */ /* Update sequence id. */
data->o_arg.id = sp->so_owner_id; data->o_arg.id = sp->so_seqid.owner_id;
data->o_arg.clientid = sp->so_server->nfs_client->cl_clientid; data->o_arg.clientid = sp->so_server->nfs_client->cl_clientid;
if (data->o_arg.claim == NFS4_OPEN_CLAIM_PREVIOUS) { if (data->o_arg.claim == NFS4_OPEN_CLAIM_PREVIOUS) {
task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_NOATTR]; task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_NOATTR];
...@@ -4032,7 +4032,7 @@ static int _nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock ...@@ -4032,7 +4032,7 @@ static int _nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock
if (status != 0) if (status != 0)
goto out; goto out;
lsp = request->fl_u.nfs4_fl.owner; lsp = request->fl_u.nfs4_fl.owner;
arg.lock_owner.id = lsp->ls_id; arg.lock_owner.id = lsp->ls_seqid.owner_id;
arg.lock_owner.s_dev = server->s_dev; arg.lock_owner.s_dev = server->s_dev;
status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1); status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1);
switch (status) { switch (status) {
...@@ -4278,7 +4278,7 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl, ...@@ -4278,7 +4278,7 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl,
goto out_free_seqid; goto out_free_seqid;
p->arg.lock_stateid = &lsp->ls_stateid; p->arg.lock_stateid = &lsp->ls_stateid;
p->arg.lock_owner.clientid = server->nfs_client->cl_clientid; p->arg.lock_owner.clientid = server->nfs_client->cl_clientid;
p->arg.lock_owner.id = lsp->ls_id; p->arg.lock_owner.id = lsp->ls_seqid.owner_id;
p->arg.lock_owner.s_dev = server->s_dev; p->arg.lock_owner.s_dev = server->s_dev;
p->res.lock_seqid = p->arg.lock_seqid; p->res.lock_seqid = p->arg.lock_seqid;
p->lsp = lsp; p->lsp = lsp;
...@@ -4696,7 +4696,7 @@ void nfs4_release_lockowner(const struct nfs4_lock_state *lsp) ...@@ -4696,7 +4696,7 @@ void nfs4_release_lockowner(const struct nfs4_lock_state *lsp)
if (!args) if (!args)
return; return;
args->lock_owner.clientid = server->nfs_client->cl_clientid; args->lock_owner.clientid = server->nfs_client->cl_clientid;
args->lock_owner.id = lsp->ls_id; args->lock_owner.id = lsp->ls_seqid.owner_id;
args->lock_owner.s_dev = server->s_dev; args->lock_owner.s_dev = server->s_dev;
msg.rpc_argp = args; msg.rpc_argp = args;
rpc_call_async(server->client, &msg, 0, &nfs4_release_lockowner_ops, args); rpc_call_async(server->client, &msg, 0, &nfs4_release_lockowner_ops, args);
......
...@@ -366,7 +366,7 @@ nfs4_insert_state_owner_locked(struct nfs4_state_owner *new) ...@@ -366,7 +366,7 @@ nfs4_insert_state_owner_locked(struct nfs4_state_owner *new)
return sp; return sp;
} }
} }
err = ida_get_new(&server->openowner_id, &new->so_owner_id); err = ida_get_new(&server->openowner_id, &new->so_seqid.owner_id);
if (err) if (err)
return ERR_PTR(err); return ERR_PTR(err);
rb_link_node(&new->so_server_node, parent, p); rb_link_node(&new->so_server_node, parent, p);
...@@ -381,7 +381,7 @@ nfs4_remove_state_owner_locked(struct nfs4_state_owner *sp) ...@@ -381,7 +381,7 @@ nfs4_remove_state_owner_locked(struct nfs4_state_owner *sp)
if (!RB_EMPTY_NODE(&sp->so_server_node)) if (!RB_EMPTY_NODE(&sp->so_server_node))
rb_erase(&sp->so_server_node, &server->state_owners); rb_erase(&sp->so_server_node, &server->state_owners);
ida_remove(&server->openowner_id, sp->so_owner_id); ida_remove(&server->openowner_id, sp->so_seqid.owner_id);
} }
static void static void
...@@ -775,8 +775,8 @@ static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, f ...@@ -775,8 +775,8 @@ static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, f
default: default:
goto out_free; goto out_free;
} }
lsp->ls_id = ida_simple_get(&server->lockowner_id, 0, 0, GFP_NOFS); lsp->ls_seqid.owner_id = ida_simple_get(&server->lockowner_id, 0, 0, GFP_NOFS);
if (lsp->ls_id < 0) if (lsp->ls_seqid.owner_id < 0)
goto out_free; goto out_free;
INIT_LIST_HEAD(&lsp->ls_locks); INIT_LIST_HEAD(&lsp->ls_locks);
return lsp; return lsp;
...@@ -789,7 +789,7 @@ static void nfs4_free_lock_state(struct nfs4_lock_state *lsp) ...@@ -789,7 +789,7 @@ static void nfs4_free_lock_state(struct nfs4_lock_state *lsp)
{ {
struct nfs_server *server = lsp->ls_state->owner->so_server; struct nfs_server *server = lsp->ls_state->owner->so_server;
ida_simple_remove(&server->lockowner_id, lsp->ls_id); ida_simple_remove(&server->lockowner_id, lsp->ls_seqid.owner_id);
nfs4_destroy_seqid_counter(&lsp->ls_seqid); nfs4_destroy_seqid_counter(&lsp->ls_seqid);
kfree(lsp); kfree(lsp);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment