blob: a5a0b9500d3e344307c12e88887c8e4f6ac8328f [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
Frank Holtonefe120a2013-12-20 11:37:06 -050012#define test_msg(fmt, ...) pr_info("BTRFS: selftest: " fmt, ##__VA_ARGS__)
Josef Bacikdc11dd52013-08-14 15:05:12 -040013
Josef Bacikfaa2dbf2014-05-07 17:06:09 -040014struct btrfs_root;
Omar Sandoval7c55ee02015-09-29 20:50:36 -070015struct btrfs_trans_handle;
Josef Bacikfaa2dbf2014-05-07 17:06:09 -040016
Feifei Xub9ef22d2016-06-01 19:18:25 +080017int btrfs_test_extent_buffer_operations(u32 sectorsize, u32 nodesize);
Jeff Mahoney8632daa2016-06-20 13:16:40 -040018int btrfs_test_free_space_cache(u32 sectorsize, u32 nodesize);
Feifei Xub9ef22d2016-06-01 19:18:25 +080019int btrfs_test_extent_io(u32 sectorsize, u32 nodesize);
20int btrfs_test_inodes(u32 sectorsize, u32 nodesize);
21int btrfs_test_qgroups(u32 sectorsize, u32 nodesize);
22int btrfs_test_free_space_tree(u32 sectorsize, u32 nodesize);
Liu Bo72b28072018-01-05 12:51:12 -070023int btrfs_test_extent_map(void);
Josef Bacik294e30f2013-10-09 12:00:56 -040024struct inode *btrfs_new_test_inode(void);
Jeff Mahoneyda170662016-06-15 09:22:56 -040025struct btrfs_fs_info *btrfs_alloc_dummy_fs_info(u32 nodesize, u32 sectorsize);
Jeff Mahoney7c0260e2016-06-20 14:14:09 -040026void btrfs_free_dummy_fs_info(struct btrfs_fs_info *fs_info);
Josef Bacikfaa2dbf2014-05-07 17:06:09 -040027void btrfs_free_dummy_root(struct btrfs_root *root);
Omar Sandoval7c55ee02015-09-29 20:50:36 -070028struct btrfs_block_group_cache *
Jeff Mahoneyda170662016-06-15 09:22:56 -040029btrfs_alloc_dummy_block_group(struct btrfs_fs_info *fs_info, unsigned long length);
Omar Sandoval7c55ee02015-09-29 20:50:36 -070030void btrfs_free_dummy_block_group(struct btrfs_block_group_cache *cache);
31void btrfs_init_dummy_trans(struct btrfs_trans_handle *trans);
Josef Bacikdc11dd52013-08-14 15:05:12 -040032#else
Jeff Mahoney8632daa2016-06-20 13:16:40 -040033static inline int btrfs_run_sanity_tests(void)
Omar Sandoval7c55ee02015-09-29 20:50:36 -070034{
35 return 0;
36}
Josef Bacikdc11dd52013-08-14 15:05:12 -040037#endif
38
39#endif