@@ -90,17 +90,24 @@ _lookup_deviceid(const struct nfs_client *clp, const struct nfs4_deviceid *id,
* @id deviceid to look up
*/
struct nfs4_deviceid_node *
-nfs4_find_get_deviceid(const struct nfs_client *clp, const struct nfs4_deviceid *id)
+_find_get_deviceid(const struct nfs_client *clp, const struct nfs4_deviceid *id,
+ long hash)
{
struct nfs4_deviceid_node *d;
rcu_read_lock();
- d = _lookup_deviceid(clp, id, nfs4_deviceid_hash(id));
+ d = _lookup_deviceid(clp, id, hash);
if (!atomic_inc_not_zero(&d->ref))
d = NULL;
rcu_read_unlock();
return d;
}
+
+struct nfs4_deviceid_node *
+nfs4_find_get_deviceid(const struct nfs_client *clp, const struct nfs4_deviceid *id)
+{
+ return _find_get_deviceid(clp, id, nfs4_deviceid_hash(id));
+}
EXPORT_SYMBOL_GPL(nfs4_find_get_deviceid);
/*
@@ -189,13 +196,13 @@ nfs4_insert_deviceid_node(struct nfs4_deviceid_node *new)
long hash;
spin_lock(&nfs4_deviceid_lock);
- d = nfs4_find_get_deviceid(new->nfs_client, &new->deviceid);
+ hash = nfs4_deviceid_hash(&new->deviceid);
+ d = _find_get_deviceid(new->nfs_client, &new->deviceid, hash);
if (d) {
spin_unlock(&nfs4_deviceid_lock);
return d;
}
- hash = nfs4_deviceid_hash(&new->deviceid);
hlist_add_head_rcu(&new->node, &nfs4_deviceid_cache[hash]);
spin_unlock(&nfs4_deviceid_lock);
Signed-off-by: Benny Halevy <bhalevy@panasas.com> --- fs/nfs/pnfs_dev.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-)