summaryrefslogtreecommitdiff
path: root/fs/ext4/mballoc.c
diff options
context:
space:
mode:
authorKemeng Shi <shikemeng@huaweicloud.com>2023-09-29 00:04:05 +0800
committerTheodore Ts'o <tytso@mit.edu>2023-10-05 22:32:16 -0400
commitbdefd689b7ff0eadc3b29dc6c66556617bd1ed42 (patch)
treedc958ed136ee0d292023425a7bff361a28285cc9 /fs/ext4/mballoc.c
parent5c657db46d9ebc63e57be1408f1986c9b23368e1 (diff)
ext4: add some kunit stub for mballoc kunit test
Multiblocks allocation will read and write block bitmap and group descriptor which reside on disk. Add kunit stub to function ext4_get_group_desc, ext4_read_block_bitmap_nowait, ext4_wait_block_bitmap and ext4_mb_mark_context to avoid real IO to disk. Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> Reviewed-by: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com> Link: https://lore.kernel.org/r/20230928160407.142069-11-shikemeng@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r--fs/ext4/mballoc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index b26e4d64cd4c..401b8329d1e1 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -18,6 +18,7 @@
#include <linux/backing-dev.h>
#include <linux/freezer.h>
#include <trace/events/ext4.h>
+#include <kunit/static_stub.h>
/*
* MUSTDO:
@@ -3957,6 +3958,10 @@ ext4_mb_mark_context(handle_t *handle, struct super_block *sb, bool state,
int err;
unsigned int i, already, changed = len;
+ KUNIT_STATIC_STUB_REDIRECT(ext4_mb_mark_context,
+ handle, sb, state, group, blkoff, len,
+ flags, ret_changed);
+
if (ret_changed)
*ret_changed = 0;
bitmap_bh = ext4_read_block_bitmap(sb, group);