Skip to content

Commit 8cce83b

Browse files
committed
btrfs: tests: switch to GFP_KERNEL
There's no reason to do GFP_NOFS in tests, it's not data-heavy and memory allocation failures would affect only developers or testers. Signed-off-by: David Sterba <[email protected]>
1 parent 988f1f5 commit 8cce83b

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

fs/btrfs/tests/btrfs-tests.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,18 @@ void btrfs_destroy_test_fs(void)
8282
struct btrfs_fs_info *btrfs_alloc_dummy_fs_info(void)
8383
{
8484
struct btrfs_fs_info *fs_info = kzalloc(sizeof(struct btrfs_fs_info),
85-
GFP_NOFS);
85+
GFP_KERNEL);
8686

8787
if (!fs_info)
8888
return fs_info;
8989
fs_info->fs_devices = kzalloc(sizeof(struct btrfs_fs_devices),
90-
GFP_NOFS);
90+
GFP_KERNEL);
9191
if (!fs_info->fs_devices) {
9292
kfree(fs_info);
9393
return NULL;
9494
}
9595
fs_info->super_copy = kzalloc(sizeof(struct btrfs_super_block),
96-
GFP_NOFS);
96+
GFP_KERNEL);
9797
if (!fs_info->super_copy) {
9898
kfree(fs_info->fs_devices);
9999
kfree(fs_info);
@@ -180,11 +180,11 @@ btrfs_alloc_dummy_block_group(unsigned long length)
180180
{
181181
struct btrfs_block_group_cache *cache;
182182

183-
cache = kzalloc(sizeof(*cache), GFP_NOFS);
183+
cache = kzalloc(sizeof(*cache), GFP_KERNEL);
184184
if (!cache)
185185
return NULL;
186186
cache->free_space_ctl = kzalloc(sizeof(*cache->free_space_ctl),
187-
GFP_NOFS);
187+
GFP_KERNEL);
188188
if (!cache->free_space_ctl) {
189189
kfree(cache);
190190
return NULL;

fs/btrfs/tests/extent-io-tests.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static int test_find_delalloc(void)
9494
* test.
9595
*/
9696
for (index = 0; index < (total_dirty >> PAGE_CACHE_SHIFT); index++) {
97-
page = find_or_create_page(inode->i_mapping, index, GFP_NOFS);
97+
page = find_or_create_page(inode->i_mapping, index, GFP_KERNEL);
9898
if (!page) {
9999
test_msg("Failed to allocate test page\n");
100100
ret = -ENOMEM;
@@ -113,7 +113,7 @@ static int test_find_delalloc(void)
113113
* |--- delalloc ---|
114114
* |--- search ---|
115115
*/
116-
set_extent_delalloc(&tmp, 0, 4095, NULL, GFP_NOFS);
116+
set_extent_delalloc(&tmp, 0, 4095, NULL, GFP_KERNEL);
117117
start = 0;
118118
end = 0;
119119
found = find_lock_delalloc_range(inode, &tmp, locked_page, &start,
@@ -144,7 +144,7 @@ static int test_find_delalloc(void)
144144
test_msg("Couldn't find the locked page\n");
145145
goto out_bits;
146146
}
147-
set_extent_delalloc(&tmp, 4096, max_bytes - 1, NULL, GFP_NOFS);
147+
set_extent_delalloc(&tmp, 4096, max_bytes - 1, NULL, GFP_KERNEL);
148148
start = test_start;
149149
end = 0;
150150
found = find_lock_delalloc_range(inode, &tmp, locked_page, &start,
@@ -199,7 +199,7 @@ static int test_find_delalloc(void)
199199
*
200200
* We are re-using our test_start from above since it works out well.
201201
*/
202-
set_extent_delalloc(&tmp, max_bytes, total_dirty - 1, NULL, GFP_NOFS);
202+
set_extent_delalloc(&tmp, max_bytes, total_dirty - 1, NULL, GFP_KERNEL);
203203
start = test_start;
204204
end = 0;
205205
found = find_lock_delalloc_range(inode, &tmp, locked_page, &start,
@@ -262,7 +262,7 @@ static int test_find_delalloc(void)
262262
}
263263
ret = 0;
264264
out_bits:
265-
clear_extent_bits(&tmp, 0, total_dirty - 1, (unsigned)-1, GFP_NOFS);
265+
clear_extent_bits(&tmp, 0, total_dirty - 1, (unsigned)-1, GFP_KERNEL);
266266
out:
267267
if (locked_page)
268268
page_cache_release(locked_page);
@@ -360,7 +360,7 @@ static int test_eb_bitmaps(void)
360360

361361
test_msg("Running extent buffer bitmap tests\n");
362362

363-
bitmap = kmalloc(len, GFP_NOFS);
363+
bitmap = kmalloc(len, GFP_KERNEL);
364364
if (!bitmap) {
365365
test_msg("Couldn't allocate test bitmap\n");
366366
return -ENOMEM;

fs/btrfs/tests/inode-tests.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ static int test_extent_accounting(void)
974974
(BTRFS_MAX_EXTENT_SIZE >> 1) + 4095,
975975
EXTENT_DELALLOC | EXTENT_DIRTY |
976976
EXTENT_UPTODATE | EXTENT_DO_ACCOUNTING, 0, 0,
977-
NULL, GFP_NOFS);
977+
NULL, GFP_KERNEL);
978978
if (ret) {
979979
test_msg("clear_extent_bit returned %d\n", ret);
980980
goto out;
@@ -1045,7 +1045,7 @@ static int test_extent_accounting(void)
10451045
BTRFS_MAX_EXTENT_SIZE+8191,
10461046
EXTENT_DIRTY | EXTENT_DELALLOC |
10471047
EXTENT_DO_ACCOUNTING | EXTENT_UPTODATE, 0, 0,
1048-
NULL, GFP_NOFS);
1048+
NULL, GFP_KERNEL);
10491049
if (ret) {
10501050
test_msg("clear_extent_bit returned %d\n", ret);
10511051
goto out;
@@ -1079,7 +1079,7 @@ static int test_extent_accounting(void)
10791079
ret = clear_extent_bit(&BTRFS_I(inode)->io_tree, 0, (u64)-1,
10801080
EXTENT_DIRTY | EXTENT_DELALLOC |
10811081
EXTENT_DO_ACCOUNTING | EXTENT_UPTODATE, 0, 0,
1082-
NULL, GFP_NOFS);
1082+
NULL, GFP_KERNEL);
10831083
if (ret) {
10841084
test_msg("clear_extent_bit returned %d\n", ret);
10851085
goto out;
@@ -1096,7 +1096,7 @@ static int test_extent_accounting(void)
10961096
clear_extent_bit(&BTRFS_I(inode)->io_tree, 0, (u64)-1,
10971097
EXTENT_DIRTY | EXTENT_DELALLOC |
10981098
EXTENT_DO_ACCOUNTING | EXTENT_UPTODATE, 0, 0,
1099-
NULL, GFP_NOFS);
1099+
NULL, GFP_KERNEL);
11001100
iput(inode);
11011101
btrfs_free_dummy_root(root);
11021102
return ret;

0 commit comments

Comments
 (0)