Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 192352
b: refs/heads/master
c: 61f8603
h: refs/heads/master
v: v3
  • Loading branch information
NeilBrown authored and J. Bruce Fields committed Mar 16, 2010
1 parent d85f424 commit 4771f29
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d202cce8963d9268ff355a386e20243e8332b308
refs/heads/master: 61f8603d93fa0b0e2f73be7a4f048696417a24a3
40 changes: 23 additions & 17 deletions trunk/fs/nfsd/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,17 +258,24 @@ static struct cache_detail svc_expkey_cache = {
.alloc = expkey_alloc,
};

static struct svc_expkey *
svc_expkey_lookup(struct svc_expkey *item)
static int
svc_expkey_hash(struct svc_expkey *item)
{
struct cache_head *ch;
int hash = item->ek_fsidtype;
char * cp = (char*)item->ek_fsid;
int len = key_len(item->ek_fsidtype);

hash ^= hash_mem(cp, len, EXPKEY_HASHBITS);
hash ^= hash_ptr(item->ek_client, EXPKEY_HASHBITS);
hash &= EXPKEY_HASHMASK;
return hash;
}

static struct svc_expkey *
svc_expkey_lookup(struct svc_expkey *item)
{
struct cache_head *ch;
int hash = svc_expkey_hash(item);

ch = sunrpc_cache_lookup(&svc_expkey_cache, &item->h,
hash);
Expand All @@ -282,13 +289,7 @@ static struct svc_expkey *
svc_expkey_update(struct svc_expkey *new, struct svc_expkey *old)
{
struct cache_head *ch;
int hash = new->ek_fsidtype;
char * cp = (char*)new->ek_fsid;
int len = key_len(new->ek_fsidtype);

hash ^= hash_mem(cp, len, EXPKEY_HASHBITS);
hash ^= hash_ptr(new->ek_client, EXPKEY_HASHBITS);
hash &= EXPKEY_HASHMASK;
int hash = svc_expkey_hash(new);

ch = sunrpc_cache_update(&svc_expkey_cache, &new->h,
&old->h, hash);
Expand Down Expand Up @@ -737,14 +738,22 @@ struct cache_detail svc_export_cache = {
.alloc = svc_export_alloc,
};

static struct svc_export *
svc_export_lookup(struct svc_export *exp)
static int
svc_export_hash(struct svc_export *exp)
{
struct cache_head *ch;
int hash;

hash = hash_ptr(exp->ex_client, EXPORT_HASHBITS);
hash ^= hash_ptr(exp->ex_path.dentry, EXPORT_HASHBITS);
hash ^= hash_ptr(exp->ex_path.mnt, EXPORT_HASHBITS);
return hash;
}

static struct svc_export *
svc_export_lookup(struct svc_export *exp)
{
struct cache_head *ch;
int hash = svc_export_hash(exp);

ch = sunrpc_cache_lookup(&svc_export_cache, &exp->h,
hash);
Expand All @@ -758,10 +767,7 @@ static struct svc_export *
svc_export_update(struct svc_export *new, struct svc_export *old)
{
struct cache_head *ch;
int hash;
hash = hash_ptr(old->ex_client, EXPORT_HASHBITS);
hash ^= hash_ptr(old->ex_path.dentry, EXPORT_HASHBITS);
hash ^= hash_ptr(old->ex_path.mnt, EXPORT_HASHBITS);
int hash = svc_export_hash(old);

ch = sunrpc_cache_update(&svc_export_cache, &new->h,
&old->h,
Expand Down

0 comments on commit 4771f29

Please sign in to comment.