From: "Petr Vaněk" <petr.vanek@e2b.dev>
To: "Theodore Ts'o" <tytso@mit.edu>,
Andreas Dilger <adilger.kernel@dilger.ca>,
Baokun Li <libaokun@linux.alibaba.com>, Jan Kara <jack@suse.cz>,
Ojaswin Mujoo <ojaswin@linux.ibm.com>,
"Ritesh Harjani (IBM)" <ritesh.list@gmail.com>,
Zhang Yi <yi.zhang@huawei.com>
Cc: "Deepanshu Kartikey" <kartikey406@gmail.com>,
"Petr Vaněk" <petr.vanek@e2b.dev>,
linux-ext4@vger.kernel.org
Subject: [PATCH 1/3] ext4: drop KUnit checks tied to the inline conversion's metadata buffer
Date: Thu, 26 Nov 2026 21:12:53 +0100 [thread overview]
Message-ID: <20261126201258.1553196-2-petr.vanek@e2b.dev> (raw)
In-Reply-To: <20261126201258.1553196-1-petr.vanek@e2b.dev>
test_convert_inline_data_and_rollback() checks that converting a
regular file's inline data writes it into the block device's buffer for
the new block, and that failures to get or dirty that buffer restore the
inline data. Those are details of how ext4_convert_inline_data_nolock()
converts the data, not of what ext4_convert_inline_data() promises, and
the next patch moves regular files to the page cache, where there is no
such buffer.
Drop the content checks on that buffer and the cases for an unmapped
block, ext4_inline_getblk() failing and ext4_handle_dirty_metadata()
failing. Keep the checks that hold for either implementation: the
conversion clears the inline data and sets the extents flag, and an
ext4_map_blocks() failure restores the inline data.
Signed-off-by: Petr Vaněk <petr.vanek@e2b.dev>
---
fs/ext4/inline-test.c | 38 ++------------------------------------
1 file changed, 2 insertions(+), 36 deletions(-)
diff --git a/fs/ext4/inline-test.c b/fs/ext4/inline-test.c
index b3d7c51ad216..3b697d4c425c 100644
--- a/fs/ext4/inline-test.c
+++ b/fs/ext4/inline-test.c
@@ -1149,7 +1149,6 @@ static void test_convert_inline_data_and_rollback(struct kunit *test)
ret = ext4_convert_inline_data(inode);
KUNIT_EXPECT_EQ(test, ret, 0);
KUNIT_EXPECT_FALSE(test, ext4_has_inline_data(inode));
- KUNIT_EXPECT_MEMEQ(test, ctx->data_block_buf, buf, sizeof(buf));
/*
* 3. Error rollback when ext4_map_blocks fails (-ENOSPC):
@@ -1171,46 +1170,13 @@ static void test_convert_inline_data_and_rollback(struct kunit *test)
ctx->map_blocks_ret = 1;
/*
- * 4. Error rollback when ext4_map_blocks returns unmapped block -> -EIO
+ * 4. Successful conversion via ext4_convert_inline_data():
+ * destroys inline data, initializes extent tree.
*/
- ctx->map_flags = 0;
- ret = ext4_convert_inline_data(inode);
- KUNIT_EXPECT_EQ(test, ret, -EIO);
- KUNIT_EXPECT_TRUE(test, ext4_has_inline_data(inode));
- ctx->map_flags = EXT4_MAP_MAPPED;
-
- /*
- * 5. Error rollback when ext4_inline_getblk returns NULL -> -ENOMEM
- */
- ctx->getblk_fail = true;
- ret = ext4_convert_inline_data(inode);
- KUNIT_EXPECT_EQ(test, ret, -ENOMEM);
- KUNIT_EXPECT_TRUE(test, ext4_has_inline_data(inode));
- ctx->getblk_fail = false;
-
- /*
- * 6. Error rollback when ext4_handle_dirty_metadata fails on data_bh
- */
- ctx->dirty_metadata_err = -EIO;
- ctx->dirty_metadata_fail_on_call = 1;
- ctx->dirty_metadata_calls = 0;
- ret = ext4_convert_inline_data(inode);
- KUNIT_EXPECT_EQ(test, ret, -EIO);
- KUNIT_EXPECT_TRUE(test, ext4_has_inline_data(inode));
- ctx->dirty_metadata_err = 0;
- ctx->dirty_metadata_fail_on_call = 0;
-
- /*
- * 7. Successful conversion via ext4_convert_inline_data():
- * copies 80 bytes into data_bh, destroys inline data, initializes
- * extent tree.
- */
- memset(ctx->data_block_buf, 0, sizeof(ctx->data_block_buf));
ret = ext4_convert_inline_data(inode);
KUNIT_EXPECT_EQ(test, ret, 0);
KUNIT_EXPECT_FALSE(test, ext4_has_inline_data(inode));
KUNIT_EXPECT_TRUE(test, ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS));
- KUNIT_EXPECT_MEMEQ(test, ctx->data_block_buf, buf, sizeof(buf));
}
static void test_write_triggers_inline_to_extent_conversion(struct kunit *test)
--
2.56.1
next prev parent reply other threads:[~2026-11-26 20:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 20:12 [PATCH 0/3] ext4: fix data loss in inline data conversion of regular files Petr Vaněk
2026-11-26 20:12 ` Petr Vaněk [this message]
2026-11-26 20:12 ` [PATCH 2/3] ext4: convert regular file inline data through the page cache Petr Vaněk
2026-11-26 20:43 ` sashiko-bot
2026-11-26 20:12 ` [PATCH 3/3] ext4: test inline data conversion " Petr Vaněk
2026-11-26 20:43 ` [PATCH 0/3] ext4: fix data loss in inline data conversion of regular files sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261126201258.1553196-2-petr.vanek@e2b.dev \
--to=petr.vanek@e2b.dev \
--cc=adilger.kernel@dilger.ca \
--cc=jack@suse.cz \
--cc=kartikey406@gmail.com \
--cc=libaokun@linux.alibaba.com \
--cc=linux-ext4@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=tytso@mit.edu \
--cc=yi.zhang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox