Skip to content

Commit 392431c

Browse files
naotakdave
authored andcommitted
btrfs: tests: add cleanup functions for test specific functions
Add auto-cleanup helper functions for btrfs_free_dummy_fs_info and btrfs_free_dummy_block_group. Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent a56a70f commit 392431c

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

fs/btrfs/tests/btrfs-tests.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
#define BTRFS_TESTS_H
88

99
#include <linux/types.h>
10+
#include <linux/cleanup.h>
1011

1112
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
13+
1214
int btrfs_run_sanity_tests(void);
1315

1416
#define test_msg(fmt, ...) pr_info("BTRFS: selftest: " fmt "\n", ##__VA_ARGS__)
@@ -49,10 +51,14 @@ int btrfs_test_chunk_allocation(u32 sectorsize, u32 nodesize);
4951
struct inode *btrfs_new_test_inode(void);
5052
struct btrfs_fs_info *btrfs_alloc_dummy_fs_info(u32 nodesize, u32 sectorsize);
5153
void btrfs_free_dummy_fs_info(struct btrfs_fs_info *fs_info);
54+
DEFINE_FREE(btrfs_free_dummy_fs_info, struct btrfs_fs_info *,
55+
btrfs_free_dummy_fs_info(_T))
5256
void btrfs_free_dummy_root(struct btrfs_root *root);
5357
struct btrfs_block_group *
5458
btrfs_alloc_dummy_block_group(struct btrfs_fs_info *fs_info, unsigned long length);
5559
void btrfs_free_dummy_block_group(struct btrfs_block_group *cache);
60+
DEFINE_FREE(btrfs_free_dummy_block_group, struct btrfs_block_group *,
61+
btrfs_free_dummy_block_group(_T));
5662
void btrfs_init_dummy_trans(struct btrfs_trans_handle *trans,
5763
struct btrfs_fs_info *fs_info);
5864
void btrfs_init_dummy_transaction(struct btrfs_transaction *trans, struct btrfs_fs_info *fs_info);

0 commit comments

Comments
 (0)