diff options
Diffstat (limited to 'fs/btrfs/hash.c')
-rw-r--r-- | fs/btrfs/hash.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/btrfs/hash.c b/fs/btrfs/hash.c index e5c76903d722..d5252f5c9d01 100644 --- a/fs/btrfs/hash.c +++ b/fs/btrfs/hash.c | |||
@@ -76,19 +76,18 @@ static void str2hashbuf(const char *msg, int len, __u32 *buf, int num) | |||
76 | *buf++ = pad; | 76 | *buf++ = pad; |
77 | } | 77 | } |
78 | 78 | ||
79 | int btrfs_name_hash(const char *name, int len, u64 *hash_result) | 79 | u64 btrfs_name_hash(const char *name, int len) |
80 | { | 80 | { |
81 | __u32 hash; | 81 | __u32 hash; |
82 | __u32 minor_hash = 0; | 82 | __u32 minor_hash = 0; |
83 | const char *p; | 83 | const char *p; |
84 | __u32 in[8], buf[2]; | 84 | __u32 in[8], buf[2]; |
85 | u64 hash_result; | ||
85 | 86 | ||
86 | if (len == 1 && *name == '.') { | 87 | if (len == 1 && *name == '.') { |
87 | *hash_result = 1; | 88 | return 1; |
88 | return 0; | ||
89 | } else if (len == 2 && name[0] == '.' && name[1] == '.') { | 89 | } else if (len == 2 && name[0] == '.' && name[1] == '.') { |
90 | *hash_result = 2; | 90 | return 2; |
91 | return 0; | ||
92 | } | 91 | } |
93 | 92 | ||
94 | /* Initialize the default seed for the hash checksum functions */ | 93 | /* Initialize the default seed for the hash checksum functions */ |
@@ -106,8 +105,8 @@ int btrfs_name_hash(const char *name, int len, u64 *hash_result) | |||
106 | } | 105 | } |
107 | hash = buf[0]; | 106 | hash = buf[0]; |
108 | minor_hash = buf[1]; | 107 | minor_hash = buf[1]; |
109 | *hash_result = buf[0]; | 108 | hash_result = buf[0]; |
110 | *hash_result <<= 32; | 109 | hash_result <<= 32; |
111 | *hash_result |= buf[1]; | 110 | hash_result |= buf[1]; |
112 | return 0; | 111 | return hash_result; |
113 | } | 112 | } |