blob: 70ff9f9d86a1b2e35a050fb877d473f74751b282 [file] [log] [blame]
David Sterba9888c342018-04-03 19:16:55 +02001/* SPDX-License-Identifier: GPL-2.0 */
Josef Bacikdc11dd52013-08-14 15:05:12 -04002/*
3 * Copyright (C) 2013 Fusion IO. All rights reserved.
Josef Bacikdc11dd52013-08-14 15:05:12 -04004 */
5
David Sterba9888c342018-04-03 19:16:55 +02006#ifndef BTRFS_TESTS_H
7#define BTRFS_TESTS_H
Josef Bacikdc11dd52013-08-14 15:05:12 -04008
9#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
Jeff Mahoney8632daa2016-06-20 13:16:40 -040010int btrfs_run_sanity_tests(void);
Josef Bacikdc11dd52013-08-14 15:05:12 -040011
David Sterba315b76b2018-05-17 00:00:44 +020012#define test_msg(fmt, ...) pr_info("BTRFS: selftest: " fmt "\n", ##__VA_ARGS__)
David Sterba3c7251f2018-05-17 00:00:42 +020013#define test_err(fmt, ...) pr_err("BTRFS: selftest: " fmt "\n", ##__VA_ARGS__)
Josef Bacikdc11dd52013-08-14 15:05:12 -040014
Josef Bacikfaa2dbf2014-05-07 17:06:09 -040015struct btrfs_root;
Omar Sandoval7c55ee02015-09-29 20:50:36 -070016struct btrfs_trans_handle;
Josef Bacikfaa2dbf2014-05-07 17:06:09 -040017
Feifei Xub9ef22d2016-06-01 19:18:25 +080018int btrfs_test_extent_buffer_operations(u32 sectorsize, u32 nodesize);
Jeff Mahoney8632daa2016-06-20 13:16:40 -040019int btrfs_test_free_space_cache(u32 sectorsize, u32 nodesize);
Feifei Xub9ef22d2016-06-01 19:18:25 +080020int btrfs_test_extent_io(u32 sectorsize, u32 nodesize);
21int btrfs_test_inodes(u32 sectorsize, u32 nodesize);
22int btrfs_test_qgroups(u32 sectorsize, u32 nodesize);
23int btrfs_test_free_space_tree(u32 sectorsize, u32 nodesize);
Liu Bo72b28072018-01-05 12:51:12 -070024int btrfs_test_extent_map(void);
Josef Bacik294e30f2013-10-09 12:00:56 -040025struct inode *btrfs_new_test_inode(void);
Jeff Mahoneyda170662016-06-15 09:22:56 -040026struct btrfs_fs_info *btrfs_alloc_dummy_fs_info(u32 nodesize, u32 sectorsize);
Jeff Mahoney7c0260e2016-06-20 14:14:09 -040027void btrfs_free_dummy_fs_info(struct btrfs_fs_info *fs_info);
Josef Bacikfaa2dbf2014-05-07 17:06:09 -040028void btrfs_free_dummy_root(struct btrfs_root *root);
Omar Sandoval7c55ee02015-09-29 20:50:36 -070029struct btrfs_block_group_cache *
Jeff Mahoneyda170662016-06-15 09:22:56 -040030btrfs_alloc_dummy_block_group(struct btrfs_fs_info *fs_info, unsigned long length);
Omar Sandoval7c55ee02015-09-29 20:50:36 -070031void btrfs_free_dummy_block_group(struct btrfs_block_group_cache *cache);
Nikolay Borisov483bce02018-05-10 15:44:40 +030032void btrfs_init_dummy_trans(struct btrfs_trans_handle *trans,
33 struct btrfs_fs_info *fs_info);
Josef Bacikdc11dd52013-08-14 15:05:12 -040034#else
Jeff Mahoney8632daa2016-06-20 13:16:40 -040035static inline int btrfs_run_sanity_tests(void)
Omar Sandoval7c55ee02015-09-29 20:50:36 -070036{
37 return 0;
38}
Josef Bacikdc11dd52013-08-14 15:05:12 -040039#endif
40
41#endif