David Sterba | 9888c34 | 2018-04-03 19:16:55 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Josef Bacik | dc11dd5 | 2013-08-14 15:05:12 -0400 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2013 Fusion IO. All rights reserved. |
Josef Bacik | dc11dd5 | 2013-08-14 15:05:12 -0400 | [diff] [blame] | 4 | */ |
| 5 | |
David Sterba | 9888c34 | 2018-04-03 19:16:55 +0200 | [diff] [blame^] | 6 | #ifndef BTRFS_TESTS_H |
| 7 | #define BTRFS_TESTS_H |
Josef Bacik | dc11dd5 | 2013-08-14 15:05:12 -0400 | [diff] [blame] | 8 | |
| 9 | #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS |
Jeff Mahoney | 8632daa | 2016-06-20 13:16:40 -0400 | [diff] [blame] | 10 | int btrfs_run_sanity_tests(void); |
Josef Bacik | dc11dd5 | 2013-08-14 15:05:12 -0400 | [diff] [blame] | 11 | |
Frank Holton | efe120a | 2013-12-20 11:37:06 -0500 | [diff] [blame] | 12 | #define test_msg(fmt, ...) pr_info("BTRFS: selftest: " fmt, ##__VA_ARGS__) |
Josef Bacik | dc11dd5 | 2013-08-14 15:05:12 -0400 | [diff] [blame] | 13 | |
Josef Bacik | faa2dbf | 2014-05-07 17:06:09 -0400 | [diff] [blame] | 14 | struct btrfs_root; |
Omar Sandoval | 7c55ee0 | 2015-09-29 20:50:36 -0700 | [diff] [blame] | 15 | struct btrfs_trans_handle; |
Josef Bacik | faa2dbf | 2014-05-07 17:06:09 -0400 | [diff] [blame] | 16 | |
Feifei Xu | b9ef22d | 2016-06-01 19:18:25 +0800 | [diff] [blame] | 17 | int btrfs_test_extent_buffer_operations(u32 sectorsize, u32 nodesize); |
Jeff Mahoney | 8632daa | 2016-06-20 13:16:40 -0400 | [diff] [blame] | 18 | int btrfs_test_free_space_cache(u32 sectorsize, u32 nodesize); |
Feifei Xu | b9ef22d | 2016-06-01 19:18:25 +0800 | [diff] [blame] | 19 | int btrfs_test_extent_io(u32 sectorsize, u32 nodesize); |
| 20 | int btrfs_test_inodes(u32 sectorsize, u32 nodesize); |
| 21 | int btrfs_test_qgroups(u32 sectorsize, u32 nodesize); |
| 22 | int btrfs_test_free_space_tree(u32 sectorsize, u32 nodesize); |
Liu Bo | 72b2807 | 2018-01-05 12:51:12 -0700 | [diff] [blame] | 23 | int btrfs_test_extent_map(void); |
Josef Bacik | 294e30f | 2013-10-09 12:00:56 -0400 | [diff] [blame] | 24 | struct inode *btrfs_new_test_inode(void); |
Jeff Mahoney | da17066 | 2016-06-15 09:22:56 -0400 | [diff] [blame] | 25 | struct btrfs_fs_info *btrfs_alloc_dummy_fs_info(u32 nodesize, u32 sectorsize); |
Jeff Mahoney | 7c0260e | 2016-06-20 14:14:09 -0400 | [diff] [blame] | 26 | void btrfs_free_dummy_fs_info(struct btrfs_fs_info *fs_info); |
Josef Bacik | faa2dbf | 2014-05-07 17:06:09 -0400 | [diff] [blame] | 27 | void btrfs_free_dummy_root(struct btrfs_root *root); |
Omar Sandoval | 7c55ee0 | 2015-09-29 20:50:36 -0700 | [diff] [blame] | 28 | struct btrfs_block_group_cache * |
Jeff Mahoney | da17066 | 2016-06-15 09:22:56 -0400 | [diff] [blame] | 29 | btrfs_alloc_dummy_block_group(struct btrfs_fs_info *fs_info, unsigned long length); |
Omar Sandoval | 7c55ee0 | 2015-09-29 20:50:36 -0700 | [diff] [blame] | 30 | void btrfs_free_dummy_block_group(struct btrfs_block_group_cache *cache); |
| 31 | void btrfs_init_dummy_trans(struct btrfs_trans_handle *trans); |
Josef Bacik | dc11dd5 | 2013-08-14 15:05:12 -0400 | [diff] [blame] | 32 | #else |
Jeff Mahoney | 8632daa | 2016-06-20 13:16:40 -0400 | [diff] [blame] | 33 | static inline int btrfs_run_sanity_tests(void) |
Omar Sandoval | 7c55ee0 | 2015-09-29 20:50:36 -0700 | [diff] [blame] | 34 | { |
| 35 | return 0; |
| 36 | } |
Josef Bacik | dc11dd5 | 2013-08-14 15:05:12 -0400 | [diff] [blame] | 37 | #endif |
| 38 | |
| 39 | #endif |