]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ext4: kunit tests for extent splitting and conversion
authorOjaswin Mujoo <ojaswin@linux.ibm.com>
Fri, 23 Jan 2026 06:25:32 +0000 (11:55 +0530)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 23 Jan 2026 21:48:02 +0000 (16:48 -0500)
commitcb1e0c1d1fad5bfad90d80c74ebdb53796d8a2db
tree23da4aebeb2f87c7607813a28d37a469d8a02275
parent3574c322b1d0eb32dbd76b469cb08f9a67641599
ext4: kunit tests for extent splitting and conversion

Add multiple KUnit tests to test various permutations of extent
splitting and conversion.

We test the following cases:

1. Split of unwritten extent into 2 parts and convert 1 part to written
2. Split of unwritten extent into 3 parts and convert 1 part to written
3. Split of written extent into 2 parts and convert 1 part to unwritten
4. Split of written extent into 3 parts and convert 1 part to unwritten
5. Zeroout fallback for all the above cases except 3-4 because zeroout
   is not supported for written to unwritten splits

The main function we test here is ext4_split_convert_extents().
Currently some of the tests are failing due to issues in implementation.
All failures are mitigated at other layers in ext4 [1] but still point
out the mismatch in expectation of what the caller wants vs what the
function does.

The aim is to eventually fix all the failures we see here. More detailed
implementation notes can be found in the topmost commit in the test
file.

[1] for example, EXT4_GET_BLOCKS_CONVERT doesn't really convert the
split extent to written, but rather the callers end up doing the
conversion.

Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Link: https://patch.msgid.link/22bb9d17cd88c1318a2edde48887ca7488cb8a13.1769149131.git.ojaswin@linux.ibm.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/extents-test.c [new file with mode: 0644]
fs/ext4/extents.c
fs/ext4/extents_status.c
fs/ext4/inode.c