mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
vfs: use 'unsigned long' accesses for dcache name comparison and hashing
Ok, this is hacky, and only works on little-endian machines with goo unaligned handling. And even then only with CONFIG_DEBUG_PAGEALLOC disabled, since it can access up to 7 bytes after the pathname. But it runs like a bat out of hell. Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
9f8050c4f9
commit
bfcfaa77bd
4 changed files with 150 additions and 0 deletions
23
fs/dcache.c
23
fs/dcache.c
|
|
@ -144,6 +144,28 @@ int proc_nr_dentry(ctl_table *table, int write, void __user *buffer,
|
|||
static inline int dentry_cmp(const unsigned char *cs, size_t scount,
|
||||
const unsigned char *ct, size_t tcount)
|
||||
{
|
||||
#ifdef CONFIG_DCACHE_WORD_ACCESS
|
||||
unsigned long a,b,mask;
|
||||
|
||||
if (unlikely(scount != tcount))
|
||||
return 1;
|
||||
|
||||
for (;;) {
|
||||
a = *(unsigned long *)cs;
|
||||
b = *(unsigned long *)ct;
|
||||
if (tcount < sizeof(unsigned long))
|
||||
break;
|
||||
if (unlikely(a != b))
|
||||
return 1;
|
||||
cs += sizeof(unsigned long);
|
||||
ct += sizeof(unsigned long);
|
||||
tcount -= sizeof(unsigned long);
|
||||
if (!tcount)
|
||||
return 0;
|
||||
}
|
||||
mask = ~(~0ul << tcount*8);
|
||||
return unlikely(!!((a ^ b) & mask));
|
||||
#else
|
||||
if (scount != tcount)
|
||||
return 1;
|
||||
|
||||
|
|
@ -155,6 +177,7 @@ static inline int dentry_cmp(const unsigned char *cs, size_t scount,
|
|||
tcount--;
|
||||
} while (tcount);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void __d_free(struct rcu_head *head)
|
||||
|
|
|
|||
Loading…
Reference in a new issue