[PATCH v4 0/2] ext4: add hash Kunit tests and optimize str2hashbuf

From: Guan-Chun Wu

Date: Fri May 29 2026 - 16:19:39 EST


This series adds Kunit tests for fs/ext4/hash.c and refactors
the str2hashbuf_{signed,unsigned}() helpers.

Patch 1 adds test coverage for ext4fs_dirhash(), including the main
hash variants and relevant edge cases.

Patch 2 simplifies the str2hashbuf helper implementation by processing
input in 4-byte chunks and removing function-pointer dispatch. This also
reduces overhead and shows roughly 2x improvement on longer inputs in
local testing.

Thanks,
Guan-Chun Wu

Link: https://lore.kernel.org/all/20260413065114.730231-1-409411716@xxxxxxxxxxxxxx/

---

v3 -> v4 :

- Fix a modpost undefined symbol error for ext4fs_dirhash when building
ext4-test.ko.

---

Guan-Chun Wu (2):
ext4: add Kunit coverage for directory hash computation
ext4: improve str2hashbuf by processing 4-byte chunks and removing
function pointers

fs/ext4/Makefile | 2 +-
fs/ext4/hash-test.c | 546 ++++++++++++++++++++++++++++++++++++++++++++
fs/ext4/hash.c | 67 ++++--
3 files changed, 592 insertions(+), 23 deletions(-)
create mode 100644 fs/ext4/hash-test.c

--
2.34.1