From: Kemeng Shi <shikemeng@huaweicloud.com>
To: tytso@mit.edu, adilger.kernel@dilger.ca, ritesh.list@gmail.com
Cc: ojaswin@linux.ibm.com, linux-ext4@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v7 12/12] ext4: run mballoc test with different layouts setting
Date: Wed, 20 Sep 2023 04:15:32 +0800 [thread overview]
Message-ID: <20230919201532.310085-13-shikemeng@huaweicloud.com> (raw)
In-Reply-To: <20230919201532.310085-1-shikemeng@huaweicloud.com>
Use KUNIT_CASE_PARAM to run mballoc test with different layouts setting.
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
---
fs/ext4/mballoc-test.c | 52 ++++++++++++++++++++++++++++++------------
1 file changed, 38 insertions(+), 14 deletions(-)
diff --git a/fs/ext4/mballoc-test.c b/fs/ext4/mballoc-test.c
index 120c4944d2e1..f94901fd3835 100644
--- a/fs/ext4/mballoc-test.c
+++ b/fs/ext4/mballoc-test.c
@@ -199,21 +199,11 @@ ext4_mb_mark_context_stub(handle_t *handle, struct super_block *sb, bool state,
return 0;
}
-#define TEST_BLOCKSIZE_BITS 10
-#define TEST_CLUSTER_BITS 3
-#define TEST_BLOCKS_PER_GROUP 8192
-#define TEST_GROUP_COUNT 4
-#define TEST_DESC_SIZE 64
#define TEST_GOAL_GROUP 1
static int mbt_kunit_init(struct kunit *test)
{
- struct mbt_ext4_block_layout layout = {
- .blocksize_bits = TEST_BLOCKSIZE_BITS,
- .cluster_bits = TEST_CLUSTER_BITS,
- .blocks_per_group = TEST_BLOCKS_PER_GROUP,
- .group_count = TEST_GROUP_COUNT,
- .desc_size = TEST_DESC_SIZE,
- };
+ struct mbt_ext4_block_layout *layout =
+ (struct mbt_ext4_block_layout *)(test->param_value);
struct super_block *sb;
int ret;
@@ -221,7 +211,7 @@ static int mbt_kunit_init(struct kunit *test)
if (sb == NULL)
return -ENOMEM;
- mbt_init_sb_layout(sb, &layout);
+ mbt_init_sb_layout(sb, layout);
ret = mbt_ctx_init(sb);
if (ret != 0) {
@@ -307,9 +297,43 @@ static void test_new_blocks_simple(struct kunit *test)
"unexpectedly get block when no block is available");
}
+static const struct mbt_ext4_block_layout mbt_test_layouts[] = {
+ {
+ .blocksize_bits = 10,
+ .cluster_bits = 3,
+ .blocks_per_group = 8192,
+ .group_count = 4,
+ .desc_size = 64,
+ },
+ {
+ .blocksize_bits = 12,
+ .cluster_bits = 3,
+ .blocks_per_group = 8192,
+ .group_count = 4,
+ .desc_size = 64,
+ },
+ {
+ .blocksize_bits = 16,
+ .cluster_bits = 3,
+ .blocks_per_group = 8192,
+ .group_count = 4,
+ .desc_size = 64,
+ },
+};
+
+static void mbt_show_layout(const struct mbt_ext4_block_layout *layout,
+ char *desc)
+{
+ snprintf(desc, KUNIT_PARAM_DESC_SIZE, "block_bits=%d cluster_bits=%d "
+ "blocks_per_group=%d group_count=%d desc_size=%d\n",
+ layout->blocksize_bits, layout->cluster_bits,
+ layout->blocks_per_group, layout->group_count,
+ layout->desc_size);
+}
+KUNIT_ARRAY_PARAM(mbt_layouts, mbt_test_layouts, mbt_show_layout);
static struct kunit_case mbt_test_cases[] = {
- KUNIT_CASE(test_new_blocks_simple),
+ KUNIT_CASE_PARAM(test_new_blocks_simple, mbt_layouts_gen_params),
{}
};
--
2.30.0
prev parent reply other threads:[~2023-09-19 12:16 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-19 20:15 [PATCH v7 00/12] cleanups and unit test for mballoc Kemeng Shi
2023-09-19 20:15 ` [PATCH v7 01/12] ext4: make state in ext4_mb_mark_bb to be bool Kemeng Shi
2023-09-27 6:10 ` Ritesh Harjani
2023-09-27 6:51 ` Kemeng Shi
2023-09-19 20:15 ` [PATCH v7 02/12] ext4: factor out codes to update block bitmap and group descriptor on disk from ext4_mb_mark_bb Kemeng Shi
2023-09-27 8:49 ` Ritesh Harjani
2023-09-28 3:31 ` Kemeng Shi
2023-09-28 4:42 ` Ritesh Harjani
2023-09-28 7:45 ` Kemeng Shi
2023-09-19 20:15 ` [PATCH v7 03/12] ext4: call ext4_mb_mark_context in ext4_free_blocks_simple Kemeng Shi
2023-09-27 8:52 ` Ritesh Harjani
2023-09-19 20:15 ` [PATCH v7 04/12] ext4: extend ext4_mb_mark_context to support allocation under journal Kemeng Shi
2023-09-27 9:13 ` Ritesh Harjani
2023-09-19 20:15 ` [PATCH v7 05/12] ext4: call ext4_mb_mark_context in ext4_mb_mark_diskspace_used Kemeng Shi
2023-09-27 9:58 ` Ritesh Harjani
2023-09-19 20:15 ` [PATCH v7 06/12] ext4: Separate block bitmap and buddy bitmap freeing in ext4_mb_clear_bb() Kemeng Shi
2023-09-27 11:06 ` Ritesh Harjani
2023-09-19 20:15 ` [PATCH v7 07/12] ext4: call ext4_mb_mark_context in ext4_mb_clear_bb Kemeng Shi
2023-09-27 11:14 ` Ritesh Harjani
2023-09-19 20:15 ` [PATCH v7 08/12] ext4: Separate block bitmap and buddy bitmap freeing in ext4_group_add_blocks() Kemeng Shi
2023-09-27 11:16 ` Ritesh Harjani
2023-09-19 20:15 ` [PATCH v7 09/12] ext4: call ext4_mb_mark_context " Kemeng Shi
2023-09-27 11:19 ` Ritesh Harjani
2023-09-19 20:15 ` [PATCH v7 10/12] ext4: add some kunit stub for mballoc kunit test Kemeng Shi
2023-09-19 20:15 ` [PATCH v7 11/12] ext4: add first unit test for ext4_mb_new_blocks_simple in mballoc Kemeng Shi
2023-09-27 11:39 ` Ritesh Harjani
2023-09-19 20:15 ` Kemeng Shi [this message]
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=20230919201532.310085-13-shikemeng@huaweicloud.com \
--to=shikemeng@huaweicloud.com \
--cc=adilger.kernel@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=tytso@mit.edu \
/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;
as well as URLs for NNTP newsgroup(s).