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

Guan-Chun Wu posted 2 patches 2 months ago
There is a newer version of this series
fs/ext4/Makefile    |   2 +-
fs/ext4/hash-test.c | 546 ++++++++++++++++++++++++++++++++++++++++++++
fs/ext4/hash.c      |  64 ++++--
3 files changed, 589 insertions(+), 23 deletions(-)
create mode 100644 fs/ext4/hash-test.c
[PATCH v3 0/2] ext4: add hash Kunit tests and optimize str2hashbuf
Posted by Guan-Chun Wu 2 months ago
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/lkml/20251122043929.1908643-1-409411716@gms.tku.edu.tw/

---

v2 -> v3 :

  - Added Kunit tests for fs/ext4/hash.c.

---

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      |  64 ++++--
 3 files changed, 589 insertions(+), 23 deletions(-)
 create mode 100644 fs/ext4/hash-test.c

-- 
2.34.1
Re: [PATCH v3 0/2] ext4: add hash Kunit tests and optimize str2hashbuf
Posted by Theodore Ts'o 2 weeks, 4 days ago
On Mon, 13 Apr 2026 14:51:12 +0800, Guan-Chun Wu wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/2] ext4: add Kunit coverage for directory hash computation
      commit: a4841d91a7f57d38d3a63c18b4ce68ee5e06829b
[2/2] ext4: improve str2hashbuf by processing 4-byte chunks and removing function pointers
      commit: d8c73397cc49362a88a57b67c11eff6e65b525e8

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>