#include <kunit/test.h>
#include <kunit/static_stub.h>
#include <linux/random.h>
#include "ext4.h"
struct mbt_grp_ctx { … };
struct mbt_ctx { … };
struct mbt_ext4_super_block { … };
#define MBT_SB(_sb) …
#define MBT_CTX(_sb) …
#define MBT_GRP_CTX(_sb, _group) …
static struct inode *mbt_alloc_inode(struct super_block *sb)
{ … }
static void mbt_free_inode(struct inode *inode)
{ … }
static const struct super_operations mbt_sops = …;
static void mbt_kill_sb(struct super_block *sb)
{ … }
static struct file_system_type mbt_fs_type = …;
static int mbt_mb_init(struct super_block *sb)
{ … }
static void mbt_mb_release(struct super_block *sb)
{ … }
static int mbt_set(struct super_block *sb, void *data)
{ … }
static struct super_block *mbt_ext4_alloc_super_block(void)
{ … }
static void mbt_ext4_free_super_block(struct super_block *sb)
{ … }
struct mbt_ext4_block_layout { … };
static void mbt_init_sb_layout(struct super_block *sb,
struct mbt_ext4_block_layout *layout)
{ … }
static int mbt_grp_ctx_init(struct super_block *sb,
struct mbt_grp_ctx *grp_ctx)
{ … }
static void mbt_grp_ctx_release(struct mbt_grp_ctx *grp_ctx)
{ … }
static void mbt_ctx_mark_used(struct super_block *sb, ext4_group_t group,
unsigned int start, unsigned int len)
{ … }
static void *mbt_ctx_bitmap(struct super_block *sb, ext4_group_t group)
{ … }
static int mbt_ctx_init(struct super_block *sb)
{ … }
static void mbt_ctx_release(struct super_block *sb)
{ … }
static struct buffer_head *
ext4_read_block_bitmap_nowait_stub(struct super_block *sb, ext4_group_t block_group,
bool ignore_locked)
{ … }
static int ext4_wait_block_bitmap_stub(struct super_block *sb,
ext4_group_t block_group,
struct buffer_head *bh)
{ … }
static struct ext4_group_desc *
ext4_get_group_desc_stub(struct super_block *sb, ext4_group_t block_group,
struct buffer_head **bh)
{ … }
static int
ext4_mb_mark_context_stub(handle_t *handle, struct super_block *sb, bool state,
ext4_group_t group, ext4_grpblk_t blkoff,
ext4_grpblk_t len, int flags,
ext4_grpblk_t *ret_changed)
{ … }
#define TEST_GOAL_GROUP …
static int mbt_kunit_init(struct kunit *test)
{ … }
static void mbt_kunit_exit(struct kunit *test)
{ … }
static void test_new_blocks_simple(struct kunit *test)
{ … }
#define TEST_RANGE_COUNT …
struct test_range { … };
static void
mbt_generate_test_ranges(struct super_block *sb, struct test_range *ranges,
int count)
{ … }
static void
validate_free_blocks_simple(struct kunit *test, struct super_block *sb,
ext4_group_t goal_group, ext4_grpblk_t start,
ext4_grpblk_t len)
{ … }
static void
test_free_blocks_simple_range(struct kunit *test, ext4_group_t goal_group,
ext4_grpblk_t start, ext4_grpblk_t len)
{ … }
static void test_free_blocks_simple(struct kunit *test)
{ … }
static void
test_mark_diskspace_used_range(struct kunit *test,
struct ext4_allocation_context *ac,
ext4_grpblk_t start,
ext4_grpblk_t len)
{ … }
static void test_mark_diskspace_used(struct kunit *test)
{ … }
static void mbt_generate_buddy(struct super_block *sb, void *buddy,
void *bitmap, struct ext4_group_info *grp)
{ … }
static void
mbt_validate_group_info(struct kunit *test, struct ext4_group_info *grp1,
struct ext4_group_info *grp2)
{ … }
static void
do_test_generate_buddy(struct kunit *test, struct super_block *sb, void *bitmap,
void *mbt_buddy, struct ext4_group_info *mbt_grp,
void *ext4_buddy, struct ext4_group_info *ext4_grp)
{ … }
static void test_mb_generate_buddy(struct kunit *test)
{ … }
static void
test_mb_mark_used_range(struct kunit *test, struct ext4_buddy *e4b,
ext4_grpblk_t start, ext4_grpblk_t len, void *bitmap,
void *buddy, struct ext4_group_info *grp)
{ … }
static void test_mb_mark_used(struct kunit *test)
{ … }
static void
test_mb_free_blocks_range(struct kunit *test, struct ext4_buddy *e4b,
ext4_grpblk_t start, ext4_grpblk_t len, void *bitmap,
void *buddy, struct ext4_group_info *grp)
{ … }
static void test_mb_free_blocks(struct kunit *test)
{ … }
#define COUNT_FOR_ESTIMATE …
static void test_mb_mark_used_cost(struct kunit *test)
{ … }
static const struct mbt_ext4_block_layout mbt_test_layouts[] = …;
static void mbt_show_layout(const struct mbt_ext4_block_layout *layout,
char *desc)
{ … }
KUNIT_ARRAY_PARAM(mbt_layouts, mbt_test_layouts, mbt_show_layout);
static struct kunit_case mbt_test_cases[] = …;
static struct kunit_suite mbt_test_suite = …;
kunit_test_suites(…);
MODULE_LICENSE(…) …;