mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 12:13:51 -04:00
kernfs: simplify kernfs_name_hash()
In 'kernfs_name_hash()', 'name' is NUL-terminated so it may be directly scanned up to end without an extra call to 'strlen()'. Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Link: https://patch.msgid.link/20260617073941.472337-1-dmantipov@yandex.ru Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Danilo Krummrich
parent
32e21e9509
commit
d996995a0f
@@ -330,8 +330,8 @@ static unsigned int kernfs_name_hash(const char *name,
|
||||
const struct ns_common *ns)
|
||||
{
|
||||
unsigned long hash = init_name_hash(kernfs_ns_id(ns));
|
||||
unsigned int len = strlen(name);
|
||||
while (len--)
|
||||
|
||||
while (*name)
|
||||
hash = partial_name_hash(*name++, hash);
|
||||
hash = end_name_hash(hash);
|
||||
hash &= 0x7fffffffU;
|
||||
|
||||
Reference in New Issue
Block a user