Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 226741
b: refs/heads/master
c: 9d55c36
h: refs/heads/master
i:
  226739: 3489538
v: v3
  • Loading branch information
Nick Piggin committed Jan 7, 2011
1 parent 68e08ea commit 172025d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 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: e1bb57826381199cc79fbf44e9dfeee58fc7b339
refs/heads/master: 9d55c369bb5e695e629bc35cba2ef607755b3bee
12 changes: 3 additions & 9 deletions trunk/fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1454,9 +1454,7 @@ static struct dentry *__d_instantiate_unique(struct dentry *entry,
continue;
if (alias->d_parent != entry->d_parent)
continue;
if (qstr->len != len)
continue;
if (memcmp(qstr->name, name, len))
if (dentry_cmp(qstr->name, qstr->len, name, len))
continue;
__dget(alias);
return alias;
Expand Down Expand Up @@ -1810,9 +1808,7 @@ struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name,
tlen, tname, name))
continue;
} else {
if (tlen != len)
continue;
if (memcmp(tname, str, tlen))
if (dentry_cmp(tname, tlen, str, len))
continue;
}
/*
Expand Down Expand Up @@ -1925,9 +1921,7 @@ struct dentry *__d_lookup(struct dentry *parent, struct qstr *name)
tlen, tname, name))
goto next;
} else {
if (tlen != len)
goto next;
if (memcmp(tname, str, tlen))
if (dentry_cmp(tname, tlen, str, len))
goto next;
}

Expand Down
21 changes: 21 additions & 0 deletions trunk/include/linux/dcache.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,27 @@ struct dentry_stat_t {
};
extern struct dentry_stat_t dentry_stat;

/*
* Compare 2 name strings, return 0 if they match, otherwise non-zero.
* The strings are both count bytes long, and count is non-zero.
*/
static inline int dentry_cmp(const unsigned char *cs, size_t scount,
const unsigned char *ct, size_t tcount)
{
int ret;
if (scount != tcount)
return 1;
do {
ret = (*cs != *ct);
if (ret)
break;
cs++;
ct++;
tcount--;
} while (tcount);
return ret;
}

/* Name hashing routines. Initial hash value */
/* Hash courtesy of the R5 hash in reiserfs modulo sign bits */
#define init_name_hash() 0
Expand Down

0 comments on commit 172025d

Please sign in to comment.