Skip to content

Commit d32a4e3

Browse files
committed
Merge branch 'dev/fst-followup' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux into for-linus-4.5
2 parents bf60920 + 3e4c5ef commit d32a4e3

File tree

6 files changed

+34
-18
lines changed

6 files changed

+34
-18
lines changed

fs/btrfs/disk-io.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ static struct btrfs_lockdep_keyset {
182182
{ .id = BTRFS_TREE_RELOC_OBJECTID, .name_stem = "treloc" },
183183
{ .id = BTRFS_DATA_RELOC_TREE_OBJECTID, .name_stem = "dreloc" },
184184
{ .id = BTRFS_UUID_TREE_OBJECTID, .name_stem = "uuid" },
185+
{ .id = BTRFS_FREE_SPACE_TREE_OBJECTID, .name_stem = "free-space" },
185186
{ .id = 0, .name_stem = "tree" },
186187
};
187188

fs/btrfs/free-space-tree.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,20 @@ static inline u32 free_space_bitmap_size(u64 size, u32 sectorsize)
154154

155155
static unsigned long *alloc_bitmap(u32 bitmap_size)
156156
{
157+
void *mem;
158+
159+
/*
160+
* The allocation size varies, observed numbers were < 4K up to 16K.
161+
* Using vmalloc unconditionally would be too heavy, we'll try
162+
* contiguous allocations first.
163+
*/
164+
if (bitmap_size <= PAGE_SIZE)
165+
return kzalloc(bitmap_size, GFP_NOFS);
166+
167+
mem = kzalloc(bitmap_size, GFP_NOFS | __GFP_HIGHMEM | __GFP_NOWARN);
168+
if (mem)
169+
return mem;
170+
157171
return __vmalloc(bitmap_size, GFP_NOFS | __GFP_HIGHMEM | __GFP_ZERO,
158172
PAGE_KERNEL);
159173
}
@@ -290,7 +304,7 @@ int convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans,
290304

291305
ret = 0;
292306
out:
293-
vfree(bitmap);
307+
kvfree(bitmap);
294308
if (ret)
295309
btrfs_abort_transaction(trans, root, ret);
296310
return ret;
@@ -439,7 +453,7 @@ int convert_free_space_to_extents(struct btrfs_trans_handle *trans,
439453

440454
ret = 0;
441455
out:
442-
vfree(bitmap);
456+
kvfree(bitmap);
443457
if (ret)
444458
btrfs_abort_transaction(trans, root, ret);
445459
return ret;

fs/btrfs/relocation.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,8 @@ static int is_cowonly_root(u64 root_objectid)
575575
root_objectid == BTRFS_TREE_LOG_OBJECTID ||
576576
root_objectid == BTRFS_CSUM_TREE_OBJECTID ||
577577
root_objectid == BTRFS_UUID_TREE_OBJECTID ||
578-
root_objectid == BTRFS_QUOTA_TREE_OBJECTID)
578+
root_objectid == BTRFS_QUOTA_TREE_OBJECTID ||
579+
root_objectid == BTRFS_FREE_SPACE_TREE_OBJECTID)
579580
return 1;
580581
return 0;
581582
}

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)