Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 294e30fe authored by Josef Bacik's avatar Josef Bacik Committed by Chris Mason
Browse files

Btrfs: add tests for find_lock_delalloc_range



So both Liu and I made huge messes of find_lock_delalloc_range trying to fix
stuff, me first by fixing extent size, then him by fixing something I broke and
then me again telling him to fix it a different way.  So this is obviously a
candidate for some testing.  This patch adds a pseudo fs so we can allocate fake
inodes for tests that need an inode or pages.  Then it addes a bunch of tests to
make sure find_lock_delalloc_range is acting the way it is supposed to.  With
this patch and all of our previous patches to find_lock_delalloc_range I am sure
it is working as expected now.  Thanks,

Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent 857cc2fc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -15,4 +15,4 @@ btrfs-$(CONFIG_BTRFS_FS_POSIX_ACL) += acl.o
btrfs-$(CONFIG_BTRFS_FS_CHECK_INTEGRITY) += check-integrity.o

btrfs-$(CONFIG_BTRFS_FS_RUN_SANITY_TESTS) += tests/free-space-tests.o \
	tests/extent-buffer-tests.o
	tests/extent-buffer-tests.o tests/btrfs-tests.o tests/extent-io-tests.o
+6 −0
Original line number Diff line number Diff line
@@ -47,6 +47,12 @@ extern struct kmem_cache *btrfs_path_cachep;
extern struct kmem_cache *btrfs_free_space_cachep;
struct btrfs_ordered_sum;

#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
#define STATIC noinline
#else
#define STATIC static noinline
#endif

#define BTRFS_MAGIC 0x4D5F53665248425FULL /* ascii _BHRfS_M, no null */

#define BTRFS_MAX_MIRRORS 3
+4 −5
Original line number Diff line number Diff line
@@ -1598,11 +1598,10 @@ static noinline int lock_delalloc_pages(struct inode *inode,
 *
 * 1 is returned if we find something, 0 if nothing was in the tree
 */
static noinline u64 find_lock_delalloc_range(struct inode *inode,
STATIC u64 find_lock_delalloc_range(struct inode *inode,
				    struct extent_io_tree *tree,
					     struct page *locked_page,
					     u64 *start, u64 *end,
					     u64 max_bytes)
				    struct page *locked_page, u64 *start,
				    u64 *end, u64 max_bytes)
{
	u64 delalloc_start;
	u64 delalloc_end;
+6 −0
Original line number Diff line number Diff line
@@ -345,4 +345,10 @@ int repair_io_failure(struct btrfs_fs_info *fs_info, u64 start,
int end_extent_writepage(struct page *page, int err, u64 start, u64 end);
int repair_eb_io_failure(struct btrfs_root *root, struct extent_buffer *eb,
			 int mirror_num);
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
noinline u64 find_lock_delalloc_range(struct inode *inode,
				      struct extent_io_tree *tree,
				      struct page *locked_page, u64 *start,
				      u64 *end, u64 max_bytes);
#endif
#endif
+12 −2
Original line number Diff line number Diff line
@@ -1791,10 +1791,20 @@ static int btrfs_run_sanity_tests(void)
{
	int ret;

	ret = btrfs_init_test_fs();
	if (ret)
		return ret;

	ret = btrfs_test_free_space_cache();
	if (ret)
		goto out;
	ret = btrfs_test_extent_buffer_operations();
	if (ret)
		goto out;
	ret = btrfs_test_extent_io();
out:
	btrfs_destroy_test_fs();
	return ret;
	return btrfs_test_extent_buffer_operations();
}

static int __init init_btrfs_fs(void)
Loading