]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
btrfs: tests: Use BTRFS_MAX_EXTENT_SIZE to replace the intermediate number
authorQu Wenruo <wqu@suse.com>
Sat, 3 Nov 2018 09:24:52 +0000 (17:24 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 17 Dec 2018 13:51:30 +0000 (14:51 +0100)
In extent-io self test, we need 2 ordered extents at its maximum size to
do the test.

Instead of using the intermediate numbers, use BTRFS_MAX_EXTENT_SIZE for
@max_bytes, and twice @max_bytes for @total_dirty.  This should explain
why we need all these magic numbers and prevent people to modify them by
accident.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tests/extent-io-tests.c

index ac8b5e35797d29b3c1dfa8f734e3169158383390..a99dc04331b4fabb2e2fecc07c40c276ca07a255 100644 (file)
@@ -62,8 +62,9 @@ static int test_find_delalloc(u32 sectorsize)
        struct page *page;
        struct page *locked_page = NULL;
        unsigned long index = 0;
-       u64 total_dirty = SZ_256M;
-       u64 max_bytes = SZ_128M;
+       /* In this test we need at least 2 file extents at its maximum size */
+       u64 max_bytes = BTRFS_MAX_EXTENT_SIZE;
+       u64 total_dirty = 2 * max_bytes;
        u64 start, end, test_start;
        u64 found;
        int ret = -EINVAL;