Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (C) 2013 Fusion IO.  All rights reserved.
0004  */
0005 
0006 #ifndef BTRFS_TESTS_H
0007 #define BTRFS_TESTS_H
0008 
0009 #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
0010 int btrfs_run_sanity_tests(void);
0011 
0012 #define test_msg(fmt, ...) pr_info("BTRFS: selftest: " fmt "\n", ##__VA_ARGS__)
0013 #define test_err(fmt, ...) pr_err("BTRFS: selftest: %s:%d " fmt "\n",   \
0014         __FILE__, __LINE__, ##__VA_ARGS__)
0015 
0016 #define test_std_err(index) test_err("%s", test_error[index])
0017 
0018 enum {
0019     TEST_ALLOC_FS_INFO,
0020     TEST_ALLOC_ROOT,
0021     TEST_ALLOC_EXTENT_BUFFER,
0022     TEST_ALLOC_PATH,
0023     TEST_ALLOC_INODE,
0024     TEST_ALLOC_BLOCK_GROUP,
0025     TEST_ALLOC_EXTENT_MAP,
0026 };
0027 
0028 extern const char *test_error[];
0029 
0030 struct btrfs_root;
0031 struct btrfs_trans_handle;
0032 
0033 int btrfs_test_extent_buffer_operations(u32 sectorsize, u32 nodesize);
0034 int btrfs_test_free_space_cache(u32 sectorsize, u32 nodesize);
0035 int btrfs_test_extent_io(u32 sectorsize, u32 nodesize);
0036 int btrfs_test_inodes(u32 sectorsize, u32 nodesize);
0037 int btrfs_test_qgroups(u32 sectorsize, u32 nodesize);
0038 int btrfs_test_free_space_tree(u32 sectorsize, u32 nodesize);
0039 int btrfs_test_extent_map(void);
0040 struct inode *btrfs_new_test_inode(void);
0041 struct btrfs_fs_info *btrfs_alloc_dummy_fs_info(u32 nodesize, u32 sectorsize);
0042 void btrfs_free_dummy_fs_info(struct btrfs_fs_info *fs_info);
0043 void btrfs_free_dummy_root(struct btrfs_root *root);
0044 struct btrfs_block_group *
0045 btrfs_alloc_dummy_block_group(struct btrfs_fs_info *fs_info, unsigned long length);
0046 void btrfs_free_dummy_block_group(struct btrfs_block_group *cache);
0047 void btrfs_init_dummy_trans(struct btrfs_trans_handle *trans,
0048                 struct btrfs_fs_info *fs_info);
0049 struct btrfs_device *btrfs_alloc_dummy_device(struct btrfs_fs_info *fs_info);
0050 #else
0051 static inline int btrfs_run_sanity_tests(void)
0052 {
0053     return 0;
0054 }
0055 #endif
0056 
0057 #endif