Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vfs: uninline full_name_hash()

.. and also use it in lookup_one_len() rather than open-coding it.

There aren't any performance-critical users, so inlining it is silly.
But it wouldn't matter if it wasn't for the fact that the word-at-a-time
dentry name patches want to conditionally replace the function, and
uninlining it sets the stage for that.

So again, this is a preparatory patch that doesn't change any semantics,
and only prepares for a much cleaner and testable word-at-a-time dentry
name accessor patch.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+10 -12
+9 -4
fs/namei.c
··· 1374 1374 return 1; 1375 1375 } 1376 1376 1377 + unsigned int full_name_hash(const unsigned char *name, unsigned int len) 1378 + { 1379 + unsigned long hash = init_name_hash(); 1380 + while (len--) 1381 + hash = partial_name_hash(*name++, hash); 1382 + return end_name_hash(hash); 1383 + } 1384 + 1377 1385 /* 1378 1386 * Name resolution. 1379 1387 * This is the basic name resolution function, turning a pathname into ··· 1783 1775 struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) 1784 1776 { 1785 1777 struct qstr this; 1786 - unsigned long hash; 1787 1778 unsigned int c; 1788 1779 1789 1780 WARN_ON_ONCE(!mutex_is_locked(&base->d_inode->i_mutex)); 1790 1781 1791 1782 this.name = name; 1792 1783 this.len = len; 1784 + this.hash = full_name_hash(name, len); 1793 1785 if (!len) 1794 1786 return ERR_PTR(-EACCES); 1795 1787 1796 - hash = init_name_hash(); 1797 1788 while (len--) { 1798 1789 c = *(const unsigned char *)name++; 1799 1790 if (c == '/' || c == '\0') 1800 1791 return ERR_PTR(-EACCES); 1801 - hash = partial_name_hash(c, hash); 1802 1792 } 1803 - this.hash = end_name_hash(hash); 1804 1793 /* 1805 1794 * See if the low-level filesystem might want 1806 1795 * to use its own hash..
+1 -8
include/linux/dcache.h
··· 89 89 } 90 90 91 91 /* Compute the hash for a name string. */ 92 - static inline unsigned int 93 - full_name_hash(const unsigned char *name, unsigned int len) 94 - { 95 - unsigned long hash = init_name_hash(); 96 - while (len--) 97 - hash = partial_name_hash(*name++, hash); 98 - return end_name_hash(hash); 99 - } 92 + extern unsigned int full_name_hash(const unsigned char *, unsigned int); 100 93 101 94 /* 102 95 * Try to keep struct dentry aligned on 64 byte cachelines (this will