<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/fs/ext4/hash.c, branch v7.2-rc2</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v7.2-rc2</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v7.2-rc2'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-06-03T14:30:15+00:00</updated>
<entry>
<title>ext4: improve str2hashbuf by processing 4-byte chunks and removing function pointers</title>
<updated>2026-06-03T14:30:15+00:00</updated>
<author>
<name>Guan-Chun Wu</name>
<email>409411716@gms.tku.edu.tw</email>
</author>
<published>2026-05-31T08:00:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3ca1d19c1971ac4f25478eafb741e726bf2d5954'/>
<id>urn:sha1:3ca1d19c1971ac4f25478eafb741e726bf2d5954</id>
<content type='text'>
The original byte-by-byte implementation with modulo checks is less
efficient. Refactor str2hashbuf_unsigned() and str2hashbuf_signed()
to process input in explicit 4-byte chunks instead of using a
modulus-based loop to emit words byte by byte.

Additionally, the use of function pointers for selecting the appropriate
str2hashbuf implementation has been removed. Instead, the functions are
directly invoked based on the hash type, eliminating the overhead of
dynamic function calls.

Performance test (x86_64, Intel Core i7-10700 @ 2.90GHz, average over 10000
runs, using kernel module for testing):

    len | orig_s | new_s | orig_u | new_u
    ----+--------+-------+--------+-------
      1 |   70   |   71  |   63   |   63
      8 |   68   |   64  |   64   |   62
     32 |   75   |   70  |   75   |   63
     64 |   96   |   71  |  100   |   68
    255 |  192   |  108  |  187   |   84

This change improves performance, especially for larger input sizes.

Signed-off-by: Guan-Chun Wu &lt;409411716@gms.tku.edu.tw&gt;
Link: https://patch.msgid.link/20260531080019.3794809-3-409411716@gms.tku.edu.tw
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>ext4: add Kunit coverage for directory hash computation</title>
<updated>2026-06-03T14:30:15+00:00</updated>
<author>
<name>Guan-Chun Wu</name>
<email>409411716@gms.tku.edu.tw</email>
</author>
<published>2026-05-31T08:00:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3147cac6c1929f26b4687993b8c7af5b7b34496d'/>
<id>urn:sha1:3147cac6c1929f26b4687993b8c7af5b7b34496d</id>
<content type='text'>
Introduce Kunit tests for fs/ext4/hash.c to verify ext4fs_dirhash()
across the legacy, half-MD4, and TEA hash variants.

The tests cover empty, seeded hashing, and non-ASCII name handling.
They also verify error paths, including invalid hash versions and
SipHash without a configured key, and check that the signed and
unsigned hash variants differ on non-ASCII input as expected.

When CONFIG_UNICODE is enabled, the tests further verify casefolded-name
hashing and the fallback behavior for invalid input.

Co-developed-by: Chen Hao Yu &lt;edward062254@gmail.com&gt;
Signed-off-by: Chen Hao Yu &lt;edward062254@gmail.com&gt;
Signed-off-by: Guan-Chun Wu &lt;409411716@gms.tku.edu.tw&gt;
Link: https://patch.msgid.link/20260531080019.3794809-2-409411716@gms.tku.edu.tw
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>ext4: make error code in __ext4fs_dirhash() consistent.</title>
<updated>2025-11-06T15:32:33+00:00</updated>
<author>
<name>Julian Sun</name>
<email>sunjunchao@bytedance.com</email>
</author>
<published>2025-10-10T09:52:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ce3236a3c7d8e048e0bcc7f445f12f911dd9dc7d'/>
<id>urn:sha1:ce3236a3c7d8e048e0bcc7f445f12f911dd9dc7d</id>
<content type='text'>
Currently __ext4fs_dirhash() returns -1 (-EPERM) if fscrypt doesn't
have encryption key, which may confuse users. Make the error code here
consistent with existing error code.

Signed-off-by: Julian Sun &lt;sunjunchao@bytedance.com&gt;
Message-ID: &lt;20251010095257.3008275-1-sunjunchao@bytedance.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>ext4: hash: simplify kzalloc(n * 1, ...) to kzalloc(n, ...)</title>
<updated>2025-03-21T05:10:10+00:00</updated>
<author>
<name>Ethan Carter Edwards</name>
<email>ethan@ethancedwards.com</email>
</author>
<published>2025-03-16T05:33:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1e93d6f221e7cfe5e069583a2b664e79eb361ba6'/>
<id>urn:sha1:1e93d6f221e7cfe5e069583a2b664e79eb361ba6</id>
<content type='text'>
sizeof(char) evaluates to 1. Remove the churn.

Signed-off-by: Ethan Carter Edwards &lt;ethan@ethancedwards.com&gt;
Reviewed-by: Andreas Dilger &lt;adilger@dilger.ca&gt;
Link: https://patch.msgid.link/20250316-ext4-hash-kcalloc-v2-1-2a99e93ec6e0@ethancedwards.com
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>ext4: remove redundant checks of s_encoding</title>
<updated>2023-08-27T15:27:13+00:00</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2023-08-14T18:29:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b81427939590450172716093dafdda8ef52e020f'/>
<id>urn:sha1:b81427939590450172716093dafdda8ef52e020f</id>
<content type='text'>
Now that ext4 does not allow inodes with the casefold flag to be
instantiated when unsupported, it's unnecessary to repeatedly check for
support later on during random filesystem operations.

Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Link: https://lore.kernel.org/r/20230814182903.37267-3-ebiggers@kernel.org
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>ext4: improve error handling from ext4_dirhash()</title>
<updated>2023-05-13T22:05:05+00:00</updated>
<author>
<name>Theodore Ts'o</name>
<email>tytso@mit.edu</email>
</author>
<published>2023-05-06T15:59:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4b3cb1d108bfc2aebb0d7c8a52261a53cf7f5786'/>
<id>urn:sha1:4b3cb1d108bfc2aebb0d7c8a52261a53cf7f5786</id>
<content type='text'>
The ext4_dirhash() will *almost* never fail, especially when the hash
tree feature was first introduced.  However, with the addition of
support of encrypted, casefolded file names, that function can most
certainly fail today.

So make sure the callers of ext4_dirhash() properly check for
failures, and reflect the errors back up to their callers.

Cc: stable@kernel.org
Link: https://lore.kernel.org/r/20230506142419.984260-1-tytso@mit.edu
Reported-by: syzbot+394aa8a792cb99dbc837@syzkaller.appspotmail.com
Reported-by: syzbot+344aaa8697ebd232bfc8@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?id=db56459ea4ac4a676ae4b4678f633e55da005a9b
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>unicode: clean up the Kconfig symbol confusion</title>
<updated>2022-01-21T00:57:24+00:00</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2022-01-18T06:56:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5298d4bfe80f6ae6ae2777bcd1357b0022d98573'/>
<id>urn:sha1:5298d4bfe80f6ae6ae2777bcd1357b0022d98573</id>
<content type='text'>
Turn the CONFIG_UNICODE symbol into a tristate that generates some always
built in code and remove the confusing CONFIG_UNICODE_UTF8_DATA symbol.

Note that a lot of the IS_ENABLED() checks could be turned from cpp
statements into normal ifs, but this change is intended to be fairly
mechanic, so that should be cleaned up later.

Fixes: 2b3d04787012 ("unicode: Add utf8-data module")
Reported-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Reviewed-by: Eric Biggers &lt;ebiggers@google.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Gabriel Krisman Bertazi &lt;krisman@collabora.com&gt;
</content>
</entry>
<entry>
<title>ext4: handle casefolding with encryption</title>
<updated>2021-04-06T02:04:20+00:00</updated>
<author>
<name>Daniel Rosenberg</name>
<email>drosen@google.com</email>
</author>
<published>2021-03-19T07:34:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=471fbbea7ff7061b2d6474665cb5a2ceb4fd6500'/>
<id>urn:sha1:471fbbea7ff7061b2d6474665cb5a2ceb4fd6500</id>
<content type='text'>
This adds support for encryption with casefolding.

Since the name on disk is case preserving, and also encrypted, we can no
longer just recompute the hash on the fly. Additionally, to avoid
leaking extra information from the hash of the unencrypted name, we use
siphash via an fscrypt v2 policy.

The hash is stored at the end of the directory entry for all entries
inside of an encrypted and casefolded directory apart from those that
deal with '.' and '..'. This way, the change is backwards compatible
with existing ext4 filesystems.

[ Changed to advertise this feature via the file:
  /sys/fs/ext4/features/encrypted_casefold -- TYT ]

Signed-off-by: Daniel Rosenberg &lt;drosen@google.com&gt;
Reviewed-by: Andreas Dilger &lt;adilger@dilger.ca&gt;
Link: https://lore.kernel.org/r/20210319073414.1381041-2-drosen@google.com
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>ext4: use generic casefolding support</title>
<updated>2020-10-28T17:43:13+00:00</updated>
<author>
<name>Daniel Rosenberg</name>
<email>drosen@google.com</email>
</author>
<published>2020-10-28T05:08:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f8f4acb6cded4e455b2d390ce2221391fc3f09ee'/>
<id>urn:sha1:f8f4acb6cded4e455b2d390ce2221391fc3f09ee</id>
<content type='text'>
This switches ext4 over to the generic support provided in libfs.

Since casefolded dentries behave the same in ext4 and f2fs, we decrease
the maintenance burden by unifying them, and any optimizations will
immediately apply to both.

Signed-off-by: Daniel Rosenberg &lt;drosen@google.com&gt;
Reviewed-by: Eric Biggers &lt;ebiggers@google.com&gt;
Link: https://lore.kernel.org/r/20201028050820.1636571-1-drosen@google.com
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>ext4: change to use fallthrough macro</title>
<updated>2020-08-18T18:27:40+00:00</updated>
<author>
<name>Shijie Luo</name>
<email>luoshijie1@huawei.com</email>
</author>
<published>2020-08-10T11:44:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=70d7ced2ed4dc3f7f21b4f4fec0e5be5c2a5a55c'/>
<id>urn:sha1:70d7ced2ed4dc3f7f21b4f4fec0e5be5c2a5a55c</id>
<content type='text'>
Change to use fallthrough macro in switch case.

Signed-off-by: Shijie Luo &lt;luoshijie1@huawei.com&gt;
Reviewed-by: Ritesh Harjani &lt;riteshh@linux.ibm.com&gt;
Link: https://lore.kernel.org/r/20200810114435.24182-1-luoshijie1@huawei.com
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
</content>
</entry>
</feed>
