ext4: add KUnit tests for fs/ext4/dir.c
Add a KUnit test suite (ext4_dir_test) in fs/ext4/dir-test.c covering
directory entry validation, hash-cookie helpers, directory llseek, and
both linear and HTree directory iteration in fs/ext4/dir.c:
- __ext4_check_dir_entry() and ext4_check_all_de() validation across
valid blocks (including fake '.', '..', and metadata_csum tail
entries, as well as encrypted+casefolded extended-hash entries) and
corrupt rec_len, alignment, name_len, block-end slack, overrun,
out-of-bounds inode numbers, and full-block '.' entries.
- is_dx_dir(), get_dtype(), and 32-bit vs 64-bit HTree telldir hash
position conversions (hash2pos, pos2maj_hash, pos2min_hash, and
ext4_get_htree_eof).
- ext4_dir_operations open(), llseek() (64-bit and 32-bit HTree EOF
bounds vs non-DX s_bitmap_maxbytes/SEEK_END bounds and cookie
invalidation), and release().
- ext4_htree_store_dirent() rbtree ordering across major/minor hashes,
64-bit hash collision chaining, and ext4_htree_free_dir_info().
- Linear ext4_readdir() across multi-block directories with sparse
holes, deleted entries, stop/resume, unaligned f_pos revalidation on
i_version change, bad checksum and corrupt entry skipping, and
ERR_BAD_DX_DIR fallback clearing EXT4_INODE_INDEX.
- HTree ext4_dx_readdir() across multi-leaf next_hash continuations,
mid-collision extra_fname stop/resume, EOF handling, seek reset, and
mid-iteration i_version refill.
Export ext4_dir_operations, expose thin KUnit wrappers for static
helpers in fs/ext4/dir.c, and add a KUNIT_STATIC_STUB_REDIRECT hook to
ext4_htree_fill_tree().
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 files changed