btrfs: use EXPORT_FOR_TESTS for conditionally exported functions

Several functions in BTRFS are only used inside the source file they are
declared if CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not defined. However if
CONFIG_BTRFS_FS_RUN_SANITY_TESTS is defined these functions are shared
with the unit tests code.

Before the introduction of the EXPORT_FOR_TESTS macro, these functions
could not be declared as static and the compiler had a harder task when
optimizing and inlining them.

As we have EXPORT_FOR_TESTS now, use it where appropriate to support the
compiler.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Johannes Thumshirn
2018-11-19 10:38:17 +01:00
committed by David Sterba
parent f8f591df7d
commit ce9f967f31
4 changed files with 20 additions and 25 deletions

View File

@@ -107,7 +107,7 @@ static int test_find_delalloc(u32 sectorsize)
set_extent_delalloc(&tmp, 0, sectorsize - 1, 0, NULL);
start = 0;
end = 0;
found = btrfs_find_lock_delalloc_range(inode, &tmp, locked_page, &start,
found = find_lock_delalloc_range(inode, &tmp, locked_page, &start,
&end);
if (!found) {
test_err("should have found at least one delalloc");
@@ -138,7 +138,7 @@ static int test_find_delalloc(u32 sectorsize)
set_extent_delalloc(&tmp, sectorsize, max_bytes - 1, 0, NULL);
start = test_start;
end = 0;
found = btrfs_find_lock_delalloc_range(inode, &tmp, locked_page, &start,
found = find_lock_delalloc_range(inode, &tmp, locked_page, &start,
&end);
if (!found) {
test_err("couldn't find delalloc in our range");
@@ -172,7 +172,7 @@ static int test_find_delalloc(u32 sectorsize)
}
start = test_start;
end = 0;
found = btrfs_find_lock_delalloc_range(inode, &tmp, locked_page, &start,
found = find_lock_delalloc_range(inode, &tmp, locked_page, &start,
&end);
if (found) {
test_err("found range when we shouldn't have");
@@ -193,7 +193,7 @@ static int test_find_delalloc(u32 sectorsize)
set_extent_delalloc(&tmp, max_bytes, total_dirty - 1, 0, NULL);
start = test_start;
end = 0;
found = btrfs_find_lock_delalloc_range(inode, &tmp, locked_page, &start,
found = find_lock_delalloc_range(inode, &tmp, locked_page, &start,
&end);
if (!found) {
test_err("didn't find our range");
@@ -234,7 +234,7 @@ static int test_find_delalloc(u32 sectorsize)
* this changes at any point in the future we will need to fix this
* tests expected behavior.
*/
found = btrfs_find_lock_delalloc_range(inode, &tmp, locked_page, &start,
found = find_lock_delalloc_range(inode, &tmp, locked_page, &start,
&end);
if (!found) {
test_err("didn't find our range");